Skip to content

gh-12897: prevent live folder dismissed tabs from reappearing#12876

Merged
mr-cheffy merged 1 commit intozen-browser:devfrom
genu:genu/live-folder-dismissed-tabs
Mar 23, 2026
Merged

gh-12897: prevent live folder dismissed tabs from reappearing#12876
mr-cheffy merged 1 commit intozen-browser:devfrom
genu:genu/live-folder-dismissed-tabs

Conversation

@genu
Copy link
Contributor

@genu genu commented Mar 22, 2026

Dismissed live folder tabs (e.g. GitHub PRs) would reappear on startup. Two issues caused this:

  1. Empty fetch wipes dismissals: onLiveFolderFetch cleaned up dismissed items by removing any not in the current fetch results. If a fetch returned an empty list (auth expired, HTML structure changed), all dismissals were cleared — causing every PR to reappear on the next successful fetch.

  2. saveState early return: If any single folder's DOM element wasn't found, the entire saveState method returned early, preventing dismissed items for all folders from being persisted.

Fix: guard the dismissed-items cleanup with itemIds.size > 0, and change return to continue in saveState.

@genu genu requested a review from mr-cheffy as a code owner March 22, 2026 13:27
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. Bug labels Mar 22, 2026
@genu genu force-pushed the genu/live-folder-dismissed-tabs branch from 79e29d7 to e983f76 Compare March 22, 2026 14:37
@mr-cheffy mr-cheffy requested a review from Slowlife01 March 22, 2026 16:12
Copy link
Member

@mr-cheffy mr-cheffy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this even run if there has been an error while fetching? Also, is there an existing issue for this? If not, please create one if you dont mind

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 22, 2026
@genu
Copy link
Contributor Author

genu commented Mar 23, 2026

To answer your question — no, this cleanup code does not run when fetchItems() returns an error. Error results (strings like "zen-live-folder-github-no-auth") cause onLiveFolderFetch to return early at the top of the method, before reaching the cleanup loop.

The guard is needed for a different case: when the fetch succeeds (HTTP 200) but the HTML does not contain the expected structure — e.g. GitHub auth expired with a redirect instead of a 404, or a rate-limiting page. In that case fetchItems() returns an empty array (not an error string), and without the guard, the cleanup loop would wipe all dismissals.

Created #12894 for tracking.

@mr-cheffy mr-cheffy linked an issue Mar 23, 2026 that may be closed by this pull request
5 tasks
@mr-cheffy mr-cheffy changed the title fix: prevent live folder dismissed tabs from reappearing gh-12897: prevent live folder dismissed tabs from reappearing Mar 23, 2026
@mr-cheffy mr-cheffy merged commit 5493ab7 into zen-browser:dev Mar 23, 2026
@mr-cheffy
Copy link
Member

Your explanation doesn't make much sense and it just looks like something AI would spit out to justify the change (GitHub auth expired with a redirect instead of a 404. In that case, the response code wouldnt be 200 anyways), but it doesn't seem to make much harm so its fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Live folder dismissed tabs reappear on startup

3 participants