Add option to keep watching inactive tabs#156
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
2 issues found.
About Unblocked
Unblocked has been set up to automatically review your team's pull requests to identify genuine bugs and issues.
📖 Documentation — Learn more in our docs.
💬 Ask questions — Mention @unblocked to request a review or summary, or ask follow-up questions.
👍 Give feedback — React to comments with 👍 or 👎 to help us improve.
⚙️ Customize — Adjust settings in your preferences.
ab70591 to
c6ed5fa
Compare
c6ed5fa to
774903f
Compare
The subtree watcher disconnects on visibilitychange to skip work the user can't see. That's unsafe when something else still reads the page — a chat copilot, accessibility-tree agent, or sidebar extension can consume content from an inactive tab, and a page that mutates while hidden (lazy widgets, periodic refreshes, late prompt-injection payloads) would otherwise reach those consumers unredacted. Expose a user-controlled toggle (default off, matching current behavior) and a build-time override key for operators. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
774903f to
8126919
Compare
- Route-change body sweep falls back to setTimeout when scheduled while document.hidden is true. Chromium pauses requestAnimationFrame entirely in background tabs, so the safety-net sweep for runOnInactiveTabs=true would never fire — pointed out by unblocked[bot]. Added a regression test that spies on the schedulers directly (Jest's fake rAF does not simulate the pause). - Document the runOnInactiveTabs reserved key in SKILL.md and install.md alongside the existing optionsButton entry. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Chrome documents rAF as paused for background tabs, but exemptions (audible audio, WebRTC, devtools attached) keep it firing in many real-world cases. The setTimeout fallback is still the right defensive choice for the runOnInactive safety-net sweep — operators flipping that flag should not depend on those exemptions being present — but the inline comments should not claim rAF is "entirely paused." Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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
runOnInactiveTabsoption (default off, matching current behavior) controls whether the shared subtree watcher keeps observing whiledocument.hiddenis true.optionsButtonpattern, so operators can flip the baseline.Test plan
subtree-watcherunit tests cover both toggle states (start-up, runtime flip-on while hidden, flip-off while hidden, no-op while visible, route-change sweep while hidden).load-default-overridestests cover the new reserved key (success + non-boolean rejection).jestsuite (1361 tests) passes; coverage above ratchet.tsc(app + test configs),biome,eslint,knipall clean.bun run buildsucceeds;--defaultswith{\"runOnInactiveTabs\": true}is recognized.Rebase notes
Rebased onto
origin/mainpast the #164 shadow-DOM tier (PRs #165–#169) and PRs #170–#171. Reconciled with #165: the shared per-shadow-root MutationObservers added in #165 now also respect therunOnInactiveTabssetting —detachRouterObserverdisconnects shadow observers when the tab pauses,refreshObservationreattaches them, andadoptShadowRootskips observation on hosts attached while the watcher is paused. The existing shadow-DOM regression tests still pass; the newrunOnInactiveTabstests exercise the body router but the same code paths cover shadows.🤖 Generated with Claude Code