Repository navigation
fix(collection): filter with page visits, not a results frame - #9
Merged
Merged
Conversation
Back after filtering could show the filtered results under the unfiltered URL on slow CI runners. Turbo 8.0.23's frame advance pushes the URL and swaps the frame, then waits two repaints before starting the page visit that marks Turbo busy. Back in that gap was cancelled by the late visit (navigator.stop()), so the filtered page stayed. The no-cache meta from fc8cff1 closed a different path (the snapshot cache) and not this one. The collection and search filter forms and their pagination are now ordinary Turbo Drive GET visits, so there is no gap. The pages keep turbo-cache-control: no-cache, so Back and Forward refetch them. The _top targets that only escaped the frame, and wait_for_turbo_idle's frame check, are removed. New regression specs slow repaints and the unfiltered fetch to reproduce the race deterministically on both pages; they fail on main. Deviates from the design system's "results sit in a Turbo Frame the form targets" (README); maintainer ruling 2026-10-02. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It reset the filter fields after Turbo restored a page snapshot. With the filter pages uncached and filtered by page visits, Back and Forward always refetch server-rendered fields, so it no longer runs on any page that needs it. The Back/Forward field specs pass without it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SearchResults records the deviation from the design system's results frame and why; Pager, ViewSwitchForm and TileAdd lose their frame targets. The exported README, FilterBar and CollectionPage still describe the frame and need the change upstream. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ters Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Fixes the Back-button flake that failed PR #8's CI (run 37051089826): after filtering, Back to
/collectionshowed "3 of 5 items" instead of "5 items".Root cause. Turbo 8.0.23's frame advance (
turbo-frame#results+data-turbo-action="advance") does this:FrameRenderer#render).session.visit, which setshtml[aria-busy]and runsnavigator.stop().Nothing is marked busy during step 3, so
wait_for_turbo_idlepasses. If Back lands in that gap, the late visit cancels the Back visit and the filtered page stays. Theno-cachemeta from #7 (fc8cff1) closed a different race (the snapshot cache), not this one.Fix. The collection and search filter forms and their pagination are now plain Turbo Drive GET visits. Both pages keep
turbo-cache-control: no-cache, so Back and Forward refetch them.Changes
resultsturbo-frames and the frame-only_toptargets. Theframe:local on the pagination partial is gone.spec/system/back_navigation_spec.rb. They slow repaints and delay the unfiltered fetch, which reproduces the race deterministically. Both fail onmain.url-syncStimulus controller, which is dead now that these pages are never restored from a snapshot. The Back/Forward field specs pass without it.wait_for_turbo_idle: the frame check and theframes: falseworkaround are gone.SearchResults(records the deviation),Pager,ViewSwitchForm,TileAdd.Design-system deviation
The design system's README says "the results sit in a Turbo Frame the form targets". This PR deliberately departs from that (maintainer ruling, 2026-10-02). The exported
README.md,components/FilterBar.mdandcomponents/CollectionPage.mdstill describe the frame. They are left as exported, so the change needs to go into the published design system before the next export.Behaviour notes
windowstate survives, as the__markerspecs check).Test plan
bin/cipasses locally (484 examples, 0 failures)mainand pass on this branch🤖 Generated with Claude Code