Repository navigation
Conversation
Opening a story marks it read and dismiss() hides its card with opacity: 0 while intentionally keeping the layout box so triage doesn't shift the page. The layout is only rebuilt on the next render(), but returning from reader.html via the browser Back button restores the page from the back/forward cache, which runs no JavaScript. Invisible read cards are left behind as blank gaps. Listen for pageshow with event.persisted and re-render the digest view on bfcache restores.
Owner
|
Thanks for the fix. I am curious how it's working in practice? I actually started with it this way and I didn't like the page re-rendering it's layout everytime I dismissed or saved something for later. I am happy to go back to it if the experience is better for most people. |
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.
Bug Description
After opening an article in the reader and going Back, the story's card leaves an empty gap on the digest page.
Root Cause
dismiss()hides a card withopacity: 0but deliberately keeps its layout box so triage doesn't shift the page; the layout is only rebuilt on the nextrender(). Returning from/reader.htmlvia the browser Back button restores the page from the back/forward cache, which does not run JavaScript. The rebuild never happens, so read cards remain as invisible, space-consuming boxes.Fix
Add a
pageshowlistener: when the page is restored from bfcache (e.persisted) while the digest view is active, callrender()to rebuild the layout from current state. Read stories drop out entirely instead of leaving gaps.How to Verify
/reader.html, marks it read).Risk Assessment
Low. 9 added lines, single event listener, no changes to existing logic. Normal (non-bfcache) loads fire
pageshowwithpersisted === false, which is a no-op.