Fix cards past a column's first page vanishing on refresh - #3141
Merged
Merged
Conversation
A column with more than 15 cards lost every card past its first page when a Turbo refresh reloaded it, and scrolling never brought them back. Keep pagination links observed so a page loads again once a refresh removes its frame, and skip links whose page is already loaded.
The test failed on CI's MySQL jobs because a page past the first had not loaded within Capybara's default wait, and its scroll could run before the column's frame loaded. Wait for the link before scrolling to it, and allow each page load up to 10 seconds.
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.
Motivation
Board columns show cards in pages: the first 15, then 30, and so on. Each page after the first loads when its "load more" link scrolls into view. The pagination controller then stops observing the link and adds a frame for the next page next to the current one.
A Turbo page refresh, such as one broadcast to the board, reloads the column frame. The reload returns only the first page, and the morph removes the later pages' frames. The link element survives the morph, but nothing observes it any more, so the later pages never come back. A column of 17 cards shows 15 until the board is reloaded.
This regressed in #1327 (8c8dbe88), which stopped removing the link after its page loads. Before that, a reload rendered the link again as a new element, which Stimulus connected and observed, so the page came back. #1327 also patched Turbo so page morphs keep
refresh=morphframes, and #1413 (860ba1f2) replaced that patch with upstream Turbo. Neither protects the column reload that #1174 added in f5c7d3d3, which callsTurbo.morphChildrenwith no callbacks.Details