Repository navigation
Stop the journal sidebar showing API responses cached before October - #498
Merged
Merged
Conversation
The API sent no Cache-Control until 6c2a70c (26 October), so a browser could keep its copy of a sidebar list, such as the recent entries or the archive counts, as fresh and keep showing it without asking the server. The no-cache header sent now never reaches a browser that doesn't ask. Turning off jQuery's cache for the journal page adds a query string that no stored copy matches, so every list is fetched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe users page disables jQuery AJAX caching before loading journal sidebar data, adding a timestamp to GET URLs so browsers cannot reuse stale API responses cached before the server began sending appropriate cache directives. Sequence diagram for cache-busted journal sidebar API requestssequenceDiagram
participant Browser
participant UsersPage
participant API
Browser->>UsersPage: Load /users/mbsd
UsersPage->>UsersPage: $.ajaxSetup({cache: false})
UsersPage->>API: GET /api/entry/mbsd/recent?_=timestamp
API-->>UsersPage: Current journal entries
UsersPage->>API: GET /api/entry/mbsd/archive?_=timestamp
API-->>UsersPage: Current archive counts
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Collaborator
Author
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| PHP | Nov 3, 2026 4:48a.m. | Review ↗ | |
| Java | Nov 3, 2026 4:48a.m. | Review ↗ | |
| Shell | Nov 3, 2026 4:48a.m. | Review ↗ | |
| JavaScript | Nov 3, 2026 4:48a.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The journal sidebar on
/users/mbsdshowed the recent entries and archive counts as of 22 July, even though the API returns current data.Cause
/api/**responses carried noCache-Controlfrom the app. A browser could store one of these responses and treat it as fresh for a long time, perhaps because of the long expiry the front-end proxy adds.no-cache, privatesent today never reaches it.curl https://www.justjournal.com/api/entry/mbsd/recentreturns the newest entries withCache-Control: no-cacheand an ETag matching the body.Change
users.htmlcalls$.ajaxSetup({cache: false})before its sidebar requests. jQuery then adds_=<timestamp>to every GET on the page. No stored copy has that URL, so each one goes to the server.The cost is that these small requests no longer get 304s; the API already tells browsers to check every time.
Testing
UsersTemplateTestsandUsersControllerTests: 69 tests, 0 failures.Not covered
Other pages that call the API, such as
public-pages.jsfor the mood, location and security lists, aren't changed. Those lists rarely change, so stale copies of them matter less.🤖 Generated with Claude Code
Summary by Sourcery
Bug Fixes: