Prevent stale Turbo snapshot on user account/edit pages. OP-19674 - #24454
Open
dfriquet wants to merge 2 commits into
Open
Prevent stale Turbo snapshot on user account/edit pages. OP-19674#24454dfriquet wants to merge 2 commits into
dfriquet wants to merge 2 commits into
Conversation
myabc
reviewed
Jul 27, 2026
Comment on lines
+20
to
+21
| # Leave via a Turbo visit so the account snapshot gets cached. | ||
| page.execute_script("window.Turbo.visit('#{projects_path}')") |
Contributor
There was a problem hiding this comment.
Can you not perform a Turbo visit by clicking on Projects in the global menu?
I'd prefer to avoid calling Turbo implementation directly from examples (although I guess we could create a turbo_visit helper` if we find we really need to do this a lot.
dfriquet
force-pushed
the
bug/op-19674-department-stale-after-turbo-restore
branch
from
July 27, 2026 15:30
c1492d9 to
e430efb
Compare
Returning to these pages through the browser history rendered Turbo's cached snapshot, showing a department (and other attributes) an administrator had changed out-of-band. Mark them turbo-cache-control: no-cache so a restoration visit refetches.
Firefox serves these pages stale from the HTTP cache / bfcache on reload and history-back; the Turbo meta only covers Turbo's own snapshot. no-store opts out of both, fixing Firefox. Chrome revalidates and is already fresh on reload and forward navigation, so those two examples pass there and act as cross-browser guards.
dfriquet
force-pushed
the
bug/op-19674-department-stale-after-turbo-restore
branch
from
July 27, 2026 15:38
e430efb to
ad7e73f
Compare
|
Warning Flaky specs
🤖 Ask Copilot to investigateCopy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer. |
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.
Ticket
https://community.openproject.org/wp/OP-19674
What are you trying to accomplish?
When an administrator changes a user's attributes out-of-band (e.g. their department, or a custom field like Job title), the account page (
/my/account) and the admin user-edit page (/users/:id/edit) could keep showing the old values. Persistence was always correct — this is purely browser/Turbo caching.There are two independent caching layers at play, so there are two fixes:
<meta name="turbo-cache-control" content="no-cache">on both pagesCtrl+Rreload and history-back (the app only sendsmust-revalidate)Cache-Control: no-storeon both actionsThe two are complementary — neither alone is sufficient. Chrome revalidates on reload, so it never showed the reload staleness (Firefox-only); Chrome did show the Turbo-snapshot staleness on Back, which the meta fixes.
What approach did you choose and why?
content_for :header_tags, matching the pattern already used by the Angular layout.no-storevia a smallprevent_response_cachingbefore_action (ApplicationController) onMyController#accountandUsersController#edit, scoped to just these actions rather than globally.Each fix is committed with the example(s) it accounts for (the shared spec file grows across the two commits).
Tests
One
:jsspec file (account_fresh_after_out_of_band_change_spec.rb) with a shared setup and three examples, each asserting the department and job title update after an out-of-band change:no-storefix, verified manually in Firefox, since Chrome/Cuprite reload fresh regardless).The fix→example attribution was verified in both Cuprite and a real Chrome instance.
Merge checklist