Stop polling for badges nobody is looking at, and stop waking every consumer

Performancekamo-internal
Shipped
26 Agosti 2026, 02:37 UTC
Author
kamo
Commit
ab4e701

Two always-mounted providers ran a one-minute poll with no visibility gate. LegalPackageCount had none at all; TrainingPendingCount had a visibilitychange re-read but its interval ticked regardless. Every backgrounded tab therefore woke once a minute to refresh a badge nobody could see, and each wake is a request the pod answers — multiplied by open tabs, per member. Both are gated on `document.visibilityState === 'visible'` now, with the tick doubling as the re-read when the tab comes back. That is not a freshness regression, it is the opposite: the number becomes current the moment the member looks at it, where before they saw whatever the last tick left behind, up to a minute stale. Neither poll is the mechanism anyway — both counts arrive over STOMP; the interval is the safety net for frames dropped before the subscription goes live. SupportCountContext already worked this way and is what both now match. Four providers published a fresh object literal as their context value, so React saw the context change on every render of the provider and woke every consumer to hand them an identical value. All of them sit in the root layout or AuthedChrome, so "every consumer" is most of the application: - ThemeConfigContext — setLogoFullExt is stable by useState contract - SupportCountContext — both marks are useCallback'd - LegalPackageCountContext — refresh is useCallback'd - SocialAgentContext — `value={{}}`, a new empty object each render for a context that carries nothing and exists only for its STOMP subscription side effect; now a frozen module constant PublicProvider's OrgContext looks like the same bug and is deliberately left alone: the root layout is a server component, so that provider effectively never re-renders and memoizing it would be motion without movement. Verified: tsc --noEmit clean over all five contexts plus AuthedChrome with their transitive imports; all 9 guard scripts pass.

All changes

Je, unaona nini kuhusu usafiri?

Kila moja ya hizi updates ardhi katika nafasi yako ya kazi moja kwa moja. Kuanza bure na kuangalia kukua wiki baada ya wiki.

Kuwa Huru MileleMtazamo wa bei