fix(desktop): satisfy lint — read busy atom directly in tile reconcile

CI caught two lint issues in the tile-reconcile path:
- no-restricted-syntax: don't mirror the $busy atom into a ref via
  useEffect (stale-read hazard); reconcileTileTranscripts now receives a
  live getter view so the loop reads the current value at tick time.
- react-hooks/exhaustive-deps: add updateSessionState to the
  sessions.changed effect deps (stable useCallback from
  useSessionStateCache, so no extra re-subscription).

No behavioral change: regression tests 2/2, adjacent hook suite 58/58,
typecheck clean.
This commit is contained in:
beplee
2026-08-25 05:39:40 +07:00
committed by Teknium
parent db8ff4eb75
commit 3669fa3095
@@ -490,10 +490,10 @@ export function useBackgroundSync({
// transcript signatures, so no-change ticks and closed tiles cost nothing.
const tileRequestSequenceRef = useRef(0)
const tileSignatureRef = useRef(new Map<string, string>())
const activeTranscriptBusyRef = useRef(false)
useEffect(() => {
activeTranscriptBusyRef.current = activeTranscriptBusy
}, [activeTranscriptBusy])
// Read $busy.get() directly inside the reconcile loop instead of mirroring
// the atom into a ref (lint: no-restricted-syntax — refs synced from atoms
// lag one render). The reconcile runs on tick, not render, so .get() is
// always current.
const requestActiveTranscriptRefresh = useCallback(
(preservePending: boolean) => {
@@ -639,7 +639,7 @@ export function useBackgroundSync({
// (#93942 scenario A). Signature-gated per tile, so no-change ticks
// cost nothing.
void reconcileTileTranscripts({
busyRef: activeTranscriptBusyRef,
busyRef: { get current() { return $busy.get() } },
requestSequenceRef: tileRequestSequenceRef,
signatureRef: tileSignatureRef,
updateSessionState
@@ -666,7 +666,7 @@ export function useBackgroundSync({
window.clearTimeout(timer)
}
}
}, [changeEventsAvailable, gatewayState, refreshMessagingSessions, refreshSessions, requestActiveTranscriptRefresh])
}, [changeEventsAvailable, gatewayState, refreshMessagingSessions, refreshSessions, requestActiveTranscriptRefresh, updateSessionState])
// Keep the cron-jobs section live without a user action (scheduler ticks in
// the background). cron.changed (jobs.json moved: CRUD or a scheduler tick's