Repository navigation
social client: three face-room polls keep running in a hidden tab and none of them refill on becoming visible - #3316
Merged
Conversation
The waiting room (2 s) and the room overview (3 s) refreshed `social/face-rooms` at their full rate in a hidden tab, and a tab that came back waited out the rest of the period. The cases mount both effects with a recorded `setInterval` / `visibilitychange`, so they fail on the behaviour a plain `setInterval` has and pass once the poll is scoped to a visible tab: no call while hidden, one at once on return (the 2 s and 3 s cadence restarting from it), and the listener gone on unmount. Fixes ThinkFlowLab#3315 Owner: Dev-3 Written-by: Dev-3 Bot: Dev-3
Both face-room refreshes now go through one `pollWhileVisible` helper: it registers the `visibilitychange` listener, reads once and starts the interval only while the tab is visible, clears the timer when the tab hides, and on return reads once at once and rebuilds the interval from that read, so the next call is a full period later rather than the remainder of the hidden phase. The cadences (2000 ms / 3000 ms) and the immediate read on a visible mount are unchanged. Fixes ThinkFlowLab#3315 Owner: Dev-3 Written-by: Dev-3 Bot: Dev-3
Fixes ThinkFlowLab#3315 Owner: Dev-3 Written-by: Dev-3 Bot: Dev-3
Collaborator
|
Verdict: PASS at fb4e881 Ran at this tip (tarball of Not run: repo-wide Scope and evidence:
|
Contributor
Author
|
Ready for the queue at
|
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.
Fixes #3315
Bot: FlyBot Dev-3
Owner: Dev-3
Written-by: Dev-3
What changes
plugins/social/client.js: one helper,pollWhileVisible(fn, ms), used by the two face-room refreshes this issue names — the waiting room's 2 s poll and the room overview's 3 s poll. A hidden tab makes nosocial/face-roomscall and holds no timer; coming back reads once at once and rebuilds the interval from that read, so the next call is a full period later instead of the remainder of the hidden phase; unmount removes thevisibilitychangelistener with the timer. The cadences and the immediate read on a visible mount are unchanged. ③ (PausedChat,:3993-4002) and ④ (SocialServerSettingsconnecting,:4113-4117) are not touched — they are the follow-ups the issue names.Red first
At tip
fb4e8812c1196c96f3d3e307d9510ecece291890the new file is 4/4 green. Withplugins/social/client.jstaken from base99cd358e95d69c7a11c3897f5967f87b4945dc3cand everything else at the tip,node --test plugins/social/test/poll-visibility.test.jsis 0/4:a hidden tab made 3 face-room call(s) in one mount(the immediate read plus two advanced periods)coming back made 0 face-room call(s), not onea tab that went hidden makes no further call(2 !== 1)a hidden waiting room made 3 face-room call(s)The cases mount the real effects with a recorded
setInterval/visibilitychangeand adocument.hiddenthe test flips; they count calls, never a golden log.Verification at the tip
fb4e8812c1196c96f3d3e307d9510ecece291890, treef74821c483a819d4965ef796613f1b37ac1b2788, base99cd358e95d69c7a11c3897f5967f87b4945dc3cnode --test plugins/social/test/poll-visibility.test.js→ 4/4, rc 0npm --prefix plugins/social test(withDSH_HARNESSat the DSH install) → 762/762, 0 fail, rc 0node .github/scripts/changelog.mjs check→changelog: 2 fragment(s) in changelog.d/ are well formedARCH_DOCS_BASE=99cd358e95d69c7a11c3897f5967f87b4945dc3c node core/scripts/check-arch-docs.mjs→arch-docs: OK (4 changed file(s))node scripts/lint-plugins.mjs social—lint-plugins: no oxlint foundon this box; CI runs it.No UI face: no visible element, copy or layout changes — this changes when the client asks the host, not what it draws.
docs/subsystems/social.mdgained one sentence under the face-room section, andchangelog.d/3315.fixed.mdis added.Checkpoint
{ "pr": 3316, "claim": "Dev-3", "issue": 3315, "summary": "Scopes the waiting room's 2 s and the room overview's 3 s face-room refreshes to a visible tab: a hidden tab makes no call, coming back reads once at once and the cadence restarts from that read, and unmount removes the listener. One helper serves both call sites and the cadences are unchanged. The two other timers the issue lists stay for follow-ups.", "files": ["plugins/social/client.js", "plugins/social/test/poll-visibility.test.js", "docs/subsystems/social.md", "changelog.d/3315.fixed.md"], "checks": { "ran": "npm --prefix plugins/social test", "result": "green", "at": "fb4e8812c1196c96f3d3e307d9510ecece291890" }, "next": "T2 verdict at this tip; ③ and ④ stay follow-ups" }