@devries-cameron20 / t3code-1 / commits / 33d0c9637b
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

chore(lint): every React effect states its reason at the call site (#26161)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 27, 2026 at 15:51 UTC 33d0c9637bfdee7dd948aa0bc298a1e9c30bf2a4
270 files changed +611 -628
AGENTS.md
+1 -1
@@ -199,7 +199,7 @@ Architecture and its constraints: `docs/internals/overview.md`. Glossary: `docs/
199 options, and pass combinators as additional function-builder arguments.
200 - Inferred types over annotations. `any` is the enemy.
201 - Default to no comment. Write one only for a constraint, an external quirk, or an invariant the code can't show, in one line where you can and four at most. Don't restate names or signatures, narrate steps, record history, or explain the fix you just made; the PR carries that. `t3code/no-low-value-comments` enforces the length cap and the mechanical cases.
202 -- React effects are for synchronizing with something outside React. Derive in render and act in handlers instead of syncing state, but don't hide real lifecycle work in refs or stores to dodge one. The `t3code/react-effect-budget` lint rule holds each file to its count in `scripts/effect-budget.json`; a new effect states its reason with `// oxlint-disable-next-line t3code/react-effect-budget -- <why>`.
202 +- React effects are for synchronizing with something outside React. Derive in render and act in handlers instead of syncing state, but don't hide real lifecycle work in refs or stores to dodge one. The `t3code/no-unreasoned-state-sync` lint rule reports every effect; one that stays states its reason with `// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- <why>`.
203 - Our users drive agents all day and notice a dropped frame, a lying spinner, and a stale label. No continuously repainting animations; they peg the GPU on high-refresh displays.
204 - If a rule here fights the task in front of you, say so loudly and get a human sign-off before breaking it.
205
apps/mobile/src/App.tsx
+1
@@ -195,6 +195,7 @@ disposeOnFoundationReplace(typeof module === "undefined" ? undefined : module.ho
195 function SplashScreenCoordinator() {
196 const { isReady } = useAppearancePreferences();
197
198 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- hides the native splash screen once appearance preferences have loaded
199 useEffect(() => {
200 if (isReady) void SplashScreen.hide();
201 }, [isReady]);
apps/mobile/src/components/ComposerEditor.tsx
+1
@@ -61,6 +61,7 @@ export function ComposerEditor({
61 ? preferencesResult.value.composerEnterBehavior
62 : undefined;
63 const contextHistory = createComposerDraftContextHistory();
64 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- releases the attachment file leases held for native text undo when the history is replaced or unmounts
65 useEffect(() => () => contextHistory.dispose(), [contextHistory]);
66 const changeText = (text: string) => {
67 const restored = contextHistory.restore(
apps/mobile/src/components/FilePreview.ios.tsx
+1
@@ -34,6 +34,7 @@ function NativeFilePreview(props: {
34 else Dialog.alert("Could not open preview", "The file could not be loaded. Please try again.");
35 });
36
37 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- presents the native file preview and dismisses it on cleanup
38 useEffect(() => {
39 let canceled = false;
40 const presentation =
apps/mobile/src/components/FilePreview.tsx
+1
@@ -55,6 +55,7 @@ function DocumentPreview(props: {
55 "A compatible viewer must be installed. Check your connection and try again.",
56 );
57 });
58 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens the attachment in an external viewer and aborts the open on cleanup
59 useEffect(() => {
60 const controller = new AbortController();
61 const input = {
apps/mobile/src/components/FilePreviewModal.tsx
+1
@@ -86,6 +86,7 @@ function ResolvedFilePreview(props: {
86 props.onRequestClose();
87 });
88 // Resolves once per presentation and holds local file leases until it closes.
89 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- resolves preview files and holds their local file leases until the preview closes
90 useEffect(() => {
91 if (items.every((item) => "uri" in item)) return;
92 const controller = new AbortController();
apps/mobile/src/components/MediaVideoPlayer.tsx
+2
@@ -33,6 +33,7 @@ function LoadedMediaVideo(props: {
33 useMediaVideoPlayback(player, props, playback);
34 const previousPlaybackRequested = useRef(false);
35 const onPlaybackStart = useEffectEvent(() => props.onPlaybackStart?.());
36 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to native video player events to keep the shared audio session in step
37 useEffect(() => {
38 const subscription = player.addListener("playingChange", ({ isPlaying }) => {
39 if (isPlaying && !active.current && !fullscreen.current) playback.pause();
@@ -74,6 +75,7 @@ function LoadedMediaVideo(props: {
75 if (!signal.aborted && props.playRequested) await playIfUninterrupted();
76 });
77
78 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- loads the video source into the native player and aborts the load on cleanup
79 useEffect(() => {
80 const controller = new AbortController();
81 // oxlint-disable-next-line react/set-state-in-effect -- Starting a native media load publishes pending before its async result.
apps/mobile/src/components/ProjectFavicon.tsx
+1
@@ -165,6 +165,7 @@ function ProjectFaviconImage(props: {
165 );
166 // Registers with the module-level loader before the Image's native onLoad/onError can fire,
167 // so stale loads for a superseded URL under the same cacheKey are ignored.
168 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- marks this favicon URL as the current request in the module registry before the native Image reports load or error
169 useLayoutEffect(() => {
170 if (faviconRequest === null) return;
171 return beginProjectFaviconRequest(faviconRequest);
apps/mobile/src/components/VideoPreviewModal.ios.tsx
+1
@@ -65,6 +65,7 @@ function NativeVideoPreview(props: {
65 }
66 });
67
68 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- presents the native fullscreen video and owns its audio session and file lease until cleanup
69 useEffect(() => {
70 const controller = new AbortController();
71 let token: ReturnType<typeof acquireAudioSession> | null = null;
apps/mobile/src/components/ui/Notice.tsx
+1
@@ -16,6 +16,7 @@ export function Notice(props: {
16 readonly dismissLabel?: string;
17 }) {
18 const danger = props.tone === "danger";
19 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- announces the message to VoiceOver through AccessibilityInfo
20 useEffect(() => {
21 // Live regions reach TalkBack; VoiceOver needs an explicit announcement.
22 if (Platform.OS === "ios") AccessibilityInfo.announceForAccessibility(props.message);
apps/mobile/src/components/ui/OverlayPortal.tsx
+2
@@ -38,6 +38,7 @@ export function OverlayPortal(props: { readonly children: ReactNode }) {
38 // happen after commit. No dependency array: re-project after every render so
39 // the host always shows the current content (menus re-render while open —
40 // drill-in, theme).
41 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- projects children into the out-of-tree overlay host store after every commit
42 useEffect(() => {
43 entries.set(key, props.children);
44 emit();
@@ -45,6 +46,7 @@ export function OverlayPortal(props: { readonly children: ReactNode }) {
46
47 // Removal is unmount-only: deleting on every re-projection would move the
48 // entry to the end of the map and restack it above overlays opened later.
49 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- removes this entry from the overlay host store on unmount
50 useEffect(
51 () => () => {
52 entries.delete(key);
apps/mobile/src/components/ui/Toast.tsx
+2
@@ -55,6 +55,7 @@ function ToastContent(props: ToastProps & { readonly glassReady?: boolean }) {
55 const action = props.action ? (
56 <Button label={props.action.label} onPress={props.action.onPress} />
57 ) : null;
58 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- announces the toast message to VoiceOver through AccessibilityInfo
59 useEffect(() => {
60 if (Platform.OS === "ios") AccessibilityInfo.announceForAccessibility(props.message);
61 }, [props.message]);
@@ -149,6 +150,7 @@ function SwipeableToast(props: ToastProps & { readonly onDismiss: () => void })
150 const { onDismiss } = props;
151 const translation = useSharedValue(0);
152 const width = useSharedValue(0);
153 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the Reanimated swipe translation animation on unmount
154 useLayoutEffect(
155 () => () => {
156 cancelAnimation(translation);
apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx
+1
@@ -95,6 +95,7 @@ function BrowserPreviewScreen({
95 setPictureInPicture(NO_PICTURE_IN_PICTURE);
96 setSelectedTabId(tabId);
97 }
98 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- closes the focused route through the navigator once the thread has no browser tabs left
99 useEffect(() => {
100 if (focused && loaded && tabs.length === 0) onClose();
101 }, [focused, loaded, tabs.length, onClose]);
apps/mobile/src/features/browser/PreviewStreamWebView.tsx
+1
@@ -295,6 +295,7 @@ function PreviewStreamDocumentView({
295 onControl?.(null);
296 });
297 // The stream lives exactly as long as this view.
298 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- starts the bootstrap timeout and stops the WebView stream when this view unmounts
299 useLayoutEffect(() => {
300 active.current = true;
301 const view = webView.current;
apps/mobile/src/features/devices/DevicePreviewRouteScreen.tsx
+3
@@ -58,6 +58,7 @@ export function DevicePreviewRouteScreen({ route }: DevicePreviewRouteScreenProp
58 const onClose = () => navigation.goBack();
59 const { environmentId, threadId } = route.params;
60 const isBlankLink = environmentId.trim().length === 0 || threadId.trim().length === 0;
61 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pops a deep-linked route with a blank environment or thread off the navigator
62 useEffect(() => {
63 if (isBlankLink) onClose();
64 }, [isBlankLink, onClose]);
@@ -107,9 +108,11 @@ export function DevicePreviewScreen({
108 setInputConnected(connected);
109 if (connected && !embedded) setControlsVisible(false);
110 };
111 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- closes the focused route through the navigator once the thread has no device previews
112 useEffect(() => {
113 if (focused && state.data !== null && previews.length === 0) onClose();
114 }, [focused, state.data, previews.length, onClose]);
115 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to the Accelerometer while focused to toggle controls on a shake
116 useEffect(() => {
117 if (!focused || !foreground || embedded) return;
118 const shaken = createShakeDetector();
apps/mobile/src/features/devices/DeviceStreamWebView.tsx
+1
@@ -118,6 +118,7 @@ function DeviceStreamDocumentView({
118 );
119 const resetInput = useEffectEvent(() => void onInputConnected(false));
120 // The stream lives exactly as long as this view.
121 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- starts the bootstrap timeout and stops the WebView device stream when this view unmounts
122 useLayoutEffect(() => {
123 active.current = true;
124 resetInput();
apps/mobile/src/features/diffs/nativeReviewDiffSurface.ts
+3
@@ -200,6 +200,7 @@ function useNativeReviewDiffPayload(
200 onFailure?: () => void,
201 onDelivered?: (payload: string) => void,
202 ) {
203 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- sends the payload to the native diff view's imperative method, retrying per frame until it mounts
204 useEffect(() => {
205 if (payload === undefined) {
206 return;
@@ -330,10 +331,12 @@ function NativeReviewDiffContent(
331 );
332 useNativeReviewDiffPayload(nativeRef, "setTokensJson", tokensJson);
333 const onDebugRef = useRef(onDebug);
334 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- keeps the latest onDebug for callbacks the native diff view fires outside render
335 useEffect(() => {
336 onDebugRef.current = onDebug;
337 }, [onDebug]);
338 const reportedMountRef = useRef(false);
339 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reports the native surface mount to the debug callback once per mount
340 useEffect(() => {
341 // Effect replay keeps the same native content; only a new mount loses tokens.
342 if (reportedMountRef.current) return;
apps/mobile/src/features/files/AudioFilePreview.tsx
+2
@@ -24,10 +24,12 @@ export function AudioFilePreview(props: { uri: string; onRetry: () => void }) {
24 // Video teardown deactivates the shared iOS session, which would stop this player.
25 useMediaAudioSessionHold(status.playing);
26 const fullscreenVideoOpen = useFullscreenVideoOpen();
27 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- keeps the shared audio session in step with the native player status and fullscreen video
28 useEffect(() => {
29 if (fullscreenVideoOpen || status.didJustFinish || status.error) playback.pause();
30 else playback.playingChanged(status.playing);
31 }, [fullscreenVideoOpen, status.didJustFinish, status.error, status.playing, playback]);
32 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to AppState to pause playback in the background, and pauses on cleanup
33 useEffect(() => {
34 const subscription = AppState.addEventListener("change", (state) => {
35 if (state !== "active") playback.pause();
apps/mobile/src/features/files/FileTreeBrowser.tsx
+3
@@ -146,10 +146,12 @@ export function FileTreeBrowser(props: {
146 });
147
148 const { revealSelection } = props;
149 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- expands the controlled selection's ancestor directories in the file tree state
150 useEffect(() => {
151 revealSelection(controlledSelectedPath);
152 }, [controlledSelectedPath, revealSelection]);
153
154 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- requests listings for expanded directories that are not yet loaded or pending
155 useEffect(() => {
156 const visit = (nodes: ReadonlyArray<FileTreeNode>) => {
157 for (const node of nodes) {
@@ -161,6 +163,7 @@ export function FileTreeBrowser(props: {
163 visit(tree);
164 }, [tree, expandedPaths, onLoadDirectory]);
165
166 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the pending selection timer on unmount
167 useEffect(
168 () => () => {
169 if (pendingSelectionTimeoutRef.current !== null) {
apps/mobile/src/features/files/SourceFileSurface.tsx
+1
@@ -249,6 +249,7 @@ function JavaScriptSourceFileSurface(props: SourceFileSurfaceProps) {
249 ) : undefined;
250
251 // Layout effect so a pending jump is cancelled in the commit that swaps the file.
252 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the FlatList to the target line and cancels a pending jump when the file changes
253 useLayoutEffect(() => {
254 if (targetIndex === null) {
255 return;
apps/mobile/src/features/files/ZipArchiveView.tsx
+3 -3
@@ -178,7 +178,7 @@ function useZipArchive(input: {
178 const { uri, isLocal, sizeBytes } = input;
179 // The parent mints a new refresh callback on every render; it must not reload the archive.
180 const refresh = useEffectEvent(input.refresh);
181 - // oxlint-disable-next-line t3code/react-effect-budget -- Load archive bytes and cancel the stream on cleanup.
181 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Load archive bytes and cancel the stream on cleanup.
182 useEffect(() => {
183 if (!uri) return;
184 const abort = new AbortController();
@@ -652,9 +652,9 @@ function ZipEntryView(props: {
652 const [busy, setBusy] = useState<"save" | "attach" | null>(null);
653 const action = useRef<AbortController | null>(null);
654 const pendingViewerError = useRef<string | null>(null);
655 - // oxlint-disable-next-line t3code/react-effect-budget -- Cancel a pending save or attach when the entry closes.
655 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Cancel a pending save or attach when the entry closes.
656 useEffect(() => () => action.current?.abort(), []);
657 - // oxlint-disable-next-line t3code/react-effect-budget -- Write the selected entry to a cached file and release it on cleanup.
657 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Write the selected entry to a cached file and release it on cleanup.
658 useEffect(() => {
659 if (tooBig) return;
660 const controller = new AbortController();
apps/mobile/src/features/files/useFileTreeEntries.ts
+1
@@ -180,6 +180,7 @@ export function useFileTreeEntries(input: {
180 const { target } = directories;
181 const requestsByTarget = useRef(new WeakMap<object, ReturnType<typeof createRequests>>());
182 // Cancel the old target before consumers' passive effects start new directory loads.
183 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- loads the root and aborts the old target's directory requests before consumers start new loads
184 useLayoutEffect(() => {
185 const requests = getRequests(requestsByTarget.current, target);
186 requests.active = true;
apps/mobile/src/features/home/HomeScreen.tsx
+3
@@ -316,6 +316,7 @@ export function HomeScreen(props: HomeScreenProps) {
316 const listRef = useRef<LegendListRef>(null);
317 const searchMode = workspace?.state.tabs.threads.searchMode;
318 const restoredOffset = workspace?.state.tabs.threads.scrollOffset;
319 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- restores the thread list's saved scroll offset through the list ref when search goes back to resting
320 useEffect(() => {
321 if (searchMode !== "resting" || restoredOffset === undefined) return;
322 listRef.current?.scrollToOffset({
@@ -333,6 +334,7 @@ export function HomeScreen(props: HomeScreenProps) {
334 };
335 // Status-bar, accessibility and programmatic scrolls bypass the gate; activate visible rows after settling.
336 const activationTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
337 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the row activation timer on unmount
338 useEffect(() => () => clearTimeout(activationTimerRef.current), []);
339 const handleListScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {
340 onFabScroll?.(event);
@@ -481,6 +483,7 @@ export function HomeScreen(props: HomeScreenProps) {
483 onSelectThread(thread);
484 };
485 useThreadJumpShortcuts(threadListV2Items, selectThread);
486 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reads the list's visible range after commit to enable swipe gestures on those rows
487 useEffect(() => {
488 if (swipeEnabled) activateVisibleRows(threadListV2Items);
489 }, [activateVisibleRows, swipeEnabled, threadListV2Items]);
apps/mobile/src/features/home/ThreadListToolbar.tsx
+1
@@ -56,6 +56,7 @@ export function ThreadListToolbar(props: {
56 Keyboard.dismiss();
57 }, [onSearchQueryChange]);
58
59 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to BackHandler while searching to close search on Android back
60 useEffect(() => {
61 if (!searching || !listFocused) return;
62 const subscription = BackHandler.addEventListener("hardwareBackPress", () => {
apps/mobile/src/features/home/WorkspaceConnectionTitle.tsx
+1
@@ -68,6 +68,7 @@ function StatusFadeIn(props: {
68 }) {
69 const { animate } = props;
70 const [opacity] = useState(() => new Animated.Value(0));
71 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- runs the Animated opacity fade-in and stops it on cleanup
72 useEffect(() => {
73 if (!animate) return;
74 const animation = Animated.timing(opacity, {
apps/mobile/src/features/home/thread-swipe-actions.tsx
+5
@@ -164,6 +164,7 @@ export function useSwipeableScrollGate(options?: {
164 settleTimerRef.current = null;
165 }
166 }, []);
167 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the scroll settle timer on unmount
168 useEffect(() => clearSettle, [clearSettle]);
169
170 const onScrollBeginDrag = useCallback(
@@ -289,6 +290,7 @@ export function ThreadSwipeable(props: ThreadSwipeableProps) {
290 pending.resolve();
291 }, []);
292
293 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the row's Reanimated animations and settles a pending dismissal on unmount
294 useLayoutEffect(() => {
295 mountedRef.current = true;
296 return () => {
@@ -302,6 +304,7 @@ export function ThreadSwipeable(props: ThreadSwipeableProps) {
304 }, [actionOpacity, collapse, fallbackTranslation, finishDismiss]);
305
306 // Reset recycled rows in place so their child views stay mounted.
307 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- resets the swipeable and its shared values when the list recycles this row for new content
308 useLayoutEffect(() => {
309 if (contentRef.current === content) return;
310 contentRef.current = content;
@@ -309,6 +312,7 @@ export function ThreadSwipeable(props: ThreadSwipeableProps) {
312 restoreRow();
313 }, [content, finishDismiss, restoreRow]);
314
315 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- closes the open swipeable and resets its shared values when the row goes dormant
316 useLayoutEffect(() => {
317 if (props.dormant && activeTranslationRef.current && dismissalRef.current === null) {
318 restoreRow();
@@ -339,6 +343,7 @@ export function ThreadSwipeable(props: ThreadSwipeableProps) {
343 },
344 [actionOpacity, collapse, dismissing, finishDismiss, rowWidth],
345 );
346 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- registers this row's animated dismissal in the module-level thread dismissal registry
347 useLayoutEffect(
348 () =>
349 props.dormant
apps/mobile/src/features/keyboard/CommandPalette.tsx
+2
@@ -507,6 +507,7 @@ export function CommandPalette(props: {
507 // The native list follows the highlighted row. Key presses move it, but so do
508 // live thread updates and late message matches that reorder or drop the
509 // selected row under a kept selection, so no single handler owns the scroll.
510 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the native list to the highlighted row, which key presses and live result updates both move
511 useEffect(() => {
512 if (selectedIndex === 0) {
513 // Centering before the list measures its height scrolls half the first row out of view.
@@ -527,6 +528,7 @@ export function CommandPalette(props: {
528 props.onClose();
529 pendingAction.current?.();
530 }, [props]);
531 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the dismiss fallback timer on unmount
532 useEffect(
533 () => () => {
534 if (dismissFallback.current !== null) clearTimeout(dismissFallback.current);
apps/mobile/src/features/keyboard/HardwareKeyboardCommandProvider.tsx
+1
@@ -89,6 +89,7 @@ export function HardwareKeyboardCommandProvider({
89 setCopyFeedback(EMPTY_COPY_FEEDBACK);
90 }, COPY_FEEDBACK_DISMISS_MS);
91 }, []);
92 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the copy feedback timer on unmount
93 useEffect(
94 () => () => {
95 if (copyFeedbackTimerRef.current !== null) {
apps/mobile/src/features/keyboard/hardwareKeyboardCommands.ts
+1
@@ -27,6 +27,7 @@ export function useHardwareKeyboardCommand(
27 command: HardwareKeyboardCommand | ReadonlyArray<HardwareKeyboardCommand>,
28 handler: CommandHandler,
29 ): void {
30 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- registers the handler in the module-level hardware keyboard command registry
31 useEffect(() => {
32 const commands = typeof command === "string" ? [command] : command;
33 for (const command of commands) {
apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
+1
@@ -719,6 +719,7 @@ function AdaptiveWorkspaceLayoutContent(
719 );
720 const renderedRailWidth = useSharedValue(navigationRailWidth);
721 const leavingWorkspacePage = useRef(false);
722 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- animates the Reanimated rail and sidebar width shared values toward the layout's targets
723 useEffect(() => {
724 if (nativeWorkspace) return;
725 renderedRailWidth.set(withTiming(navigationRailWidth, WORKSPACE_PANE_TIMING));
apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx
+1
@@ -303,6 +303,7 @@ function WorkspaceColumns(
303 if (transition.pop) props.navigation.dispatch(transition.pop);
304 };
305
306 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- tells the native split host which column to show while collapsed
307 useEffect(() => {
308 if (layout.usesSplitView || collapsedColumn.current.visible === compactColumn) return;
309 collapsedColumn.current = { ...collapsedColumn.current, visible: compactColumn };
apps/mobile/src/features/layout/workspace-inspector-pane.tsx
+1
@@ -40,6 +40,7 @@ export function WorkspaceInspectorPane(props: {
40 const reduceMotion = useReducedMotion();
41
42 const onClosed = props.onClosed;
43 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- animates the Reanimated inspector progress and width shared values when visibility or width changes
44 useEffect(() => {
45 inspectorProgress.set(
46 withTiming(inspectorVisible ? 1 : 0, WORKSPACE_PANE_TIMING, (finished) => {
apps/mobile/src/features/projects/AddProjectScreen.tsx
+1
@@ -366,6 +366,7 @@ function useBrowsePathInput(environment: EnvironmentOption | null, pinnedDirecto
366 return committed;
367 };
368
369 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- invalidates the browse navigation coordinator on unmount so in-flight browses do not commit
370 useEffect(
371 () => () => {
372 browseNavigation.invalidate();
apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
+2
@@ -1020,6 +1020,7 @@ function PullRequestFileRouteContent({ route }: PullRequestFileRouteProps) {
1020 });
1021 // Subscribed for the whole screen, so a pick made while the diff is still loading is kept for
1022 // the first draw.
1023 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to pull request file jump requests for the screen's lifetime
1024 useEffect(() => subscribePullRequestFileJump(jumpScope, (path) => jumpToFile(path)), [jumpScope]);
1025 const { nativeReviewDiffStyle } = useAppearanceCodeSurface();
1026 const { themeAppearance, appearance, setCodeWordBreak } = useAppearancePreferences();
@@ -1034,6 +1035,7 @@ function PullRequestFileRouteContent({ route }: PullRequestFileRouteProps) {
1035 canHighlight: true,
1036 });
1037 const [NativeDiffView] = useState(() => resolveNativeReviewDiffView());
1038 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- requests the next page of the paged diff query until the jump target file has loaded
1039 useEffect(() => {
1040 if (!targetFile) loadMore();
1041 }, [targetFile, loadMore]);
apps/mobile/src/features/pull-requests/PullRequestToolbar.android.tsx
+1
@@ -41,6 +41,7 @@ export function PullRequestToolbar(props: {
41 recordScrollOffset("pullRequests", tab.searchEntryOffset);
42 dispatch({ type: "cancel", tab: "pullRequests" });
43 }, [dispatch, recordScrollOffset, tab.searchEntryOffset]);
44 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to BackHandler while searching to close the PR search on Android back
45 useEffect(() => {
46 if (!searching) return;
47 const subscription = BackHandler.addEventListener("hardwareBackPress", () => {
apps/mobile/src/features/pull-requests/PullRequestsScreen.tsx
+1
@@ -108,6 +108,7 @@ export function PullRequestsScreen(
108 // toolbar that cancels has no handle on this list, so the list scrolls itself
109 // once it sees the tab come back to resting.
110 const previousSearchMode = useRef(tab.searchMode);
111 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the list to the offset saved when search opened once the tab returns to resting
112 useEffect(() => {
113 const restoringSearch =
114 previousSearchMode.current !== "resting" && tab.searchMode === "resting";
apps/mobile/src/features/pull-requests/guide/PullRequestGuideScreen.tsx
+1
@@ -113,6 +113,7 @@ export function PullRequestGuideStopScreen({ route }: StaticScreenProps<GuideSto
113 );
114 const missing = wanted.some((path) => !loadedPaths.has(path));
115 const { error: diffError, loadMore } = diff;
116 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- requests the next page of the paged diff query until the stop's files have loaded
117 useEffect(() => {
118 if (state.enabled && missing && !diffError) loadMore();
119 }, [state.enabled, missing, diffError, loadMore]);
apps/mobile/src/features/pull-requests/usePullRequestDiff.ts
+1
@@ -44,6 +44,7 @@ export function usePullRequestDiffEntry(navigation: {
44 ) => () => void;
45 }) {
46 const [ready, setReady] = useState(false);
47 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to navigator transition events and frames to defer the diff until the opening transition ends
48 useLayoutEffect(() => {
49 if (ready) return;
50 let opening = false;
apps/mobile/src/features/pull-requests/usePullRequestEnvironmentFallback.ts
+1
@@ -17,6 +17,7 @@ export function usePullRequestEnvironmentFallback(params: PullRequestEnvironment
17 () => (isReady ? pullRequestFallbackEnvironment(params, projects, environments) : null),
18 [params, projects, environments, isReady],
19 );
20 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- rewrites the route params through the navigator to the fallback environment once connections are ready
21 useEffect(() => {
22 if (fallback) navigation.setParams(fallback);
23 }, [fallback, navigation]);
apps/mobile/src/features/pull-requests/usePullRequestReviewDraft.ts
+1
@@ -75,6 +75,7 @@ async function persist() {
75 export function usePullRequestReviewDraft(params: PullRequestParams) {
76 const snapshot = useAtomValue(state);
77 const key = pullRequestReviewKey(params);
78 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- loads review drafts from disk and persists them when AppState leaves active and on unmount
79 useEffect(() => {
80 void load();
81 const listener = AppState.addEventListener("change", (phase) => {
apps/mobile/src/features/review/useNativeReviewDiffHighlighting.ts
+2
@@ -50,6 +50,7 @@ export function useNativeReviewDiffHighlighting(input: {
50
51 // Effect on purpose: the native highlighter's token stream and the scheduler's timers must
52 // reset with the diff the view shows, and be cancelled when it unmounts.
53 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- resets the native highlighter's scheduler and token stream with the diff, cancelling its timers on cleanup
54 useEffect(() => {
55 traceDiffHighlight("viewport-reset", {
56 reset: diffHighlightTraceId(resetKey),
@@ -69,6 +70,7 @@ export function useNativeReviewDiffHighlighting(input: {
70 }, [enabled, resetKey, rows.length, scheduler, viewportScope]);
71
72 // Effect on purpose: abortable async highlighting tied to the visible range's lifetime.
73 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- runs abortable native highlighting for the visible range and aborts it when the range or diff changes
74 useEffect(() => {
75 if (!enabled || rows.length === 0 || !viewport.range || viewport.scope !== viewportScope) {
76 return;
apps/mobile/src/features/review/useReviewDiffData.ts
+1
@@ -262,6 +262,7 @@ export function useReviewDiffData(input: {
262 [draftMessage],
263 );
264
265 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- records review perf marks and diagnostic logs once a parsed diff has committed
266 useEffect(() => {
267 if (parsedDiff.kind !== "files") {
268 return;
apps/mobile/src/features/review/useReviewDiffPrewarming.ts
+1
@@ -105,6 +105,7 @@ export function useReviewDiffPrewarming(input: {
105 }): void {
106 const { sections, selectedSectionId, threadKey } = input;
107
108 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- prewarms pending review diff sections in idle callbacks and cancels the idle handle on cleanup
109 useEffect(() => {
110 if (!threadKey) {
111 return;
apps/mobile/src/features/settings/SettingsAuthRouteScreen.tsx
+1
@@ -36,6 +36,7 @@ function ConfiguredSettingsAuthRouteScreen() {
36
37 // Clerk reports sign-out only through its auth store (the native profile view
38 // and the T3 Connect page can both sign out), so this follows that store.
39 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pops the navigator when Clerk's auth store reports a sign-out from the profile view or Connect page
40 useEffect(() => {
41 if (hasBeenSignedIn && isLoaded && isSignedIn === false) {
42 navigation.goBack();
apps/mobile/src/features/settings/components/BranchNamingSettings.tsx
+1
@@ -50,6 +50,7 @@ export function BranchNamingSettings(props: {
50 const saveDrafts = useEffectEvent(() =>
51 send({ ...take("branchNamePrefix"), ...take("branchNameInstructions") }),
52 );
53 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- saves unsent branch naming drafts to server settings when the section unmounts
54 useEffect(() => () => saveDrafts(), []);
55 return (
56 <SettingsSection
apps/mobile/src/features/terminal/NativeTerminalSurface.tsx
+3
@@ -220,6 +220,7 @@ const ReadyTerminalSurface = memo(function ReadyTerminalSurface(props: ReadyTerm
220 const writerRef = useRef<ReturnType<typeof createTerminalOutputWriter> | null>(null);
221 const [nativeReady, setNativeReady] = useState(false);
222
223 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- creates the output writer for the native terminal view once it is ready and disposes it on cleanup
224 useEffect(() => {
225 const view = nativeRef.current;
226 if (!streaming || !nativeReady || view === null) return;
@@ -231,6 +232,7 @@ const ReadyTerminalSurface = memo(function ReadyTerminalSurface(props: ReadyTerm
232 };
233 }, [nativeReady, streaming]);
234
235 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- streams new terminal output into the native terminal view through its writer
236 useEffect(() => {
237 if (!streaming || !nativeReady || props.output === null) return;
238 void writerRef.current?.write(props.output).catch((error: unknown) => {
@@ -238,6 +240,7 @@ const ReadyTerminalSurface = memo(function ReadyTerminalSurface(props: ReadyTerm
240 });
241 }, [nativeReady, props.output, streaming]);
242
243 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- writes the native surface state to the terminal debug log after each relevant commit
244 useEffect(() => {
245 terminalDebugLog("native:surface", {
246 terminalKey: props.terminalKey,
apps/mobile/src/features/terminal/useTerminalExitNavigation.ts
+1 -1
@@ -39,7 +39,7 @@ export function useTerminalExitNavigation(target: {
39 );
40 });
41
42 - // oxlint-disable-next-line t3code/react-effect-budget -- focus subscription for the screen's lifetime; an exit behind another screen navigates when the user returns
42 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- focus subscription for the screen's lifetime; an exit behind another screen navigates when the user returns
43 useEffect(
44 () =>
45 navigation.addListener("focus", () => {
apps/mobile/src/features/threads/ComposerPopoverAnchor.android.tsx
+2
@@ -28,6 +28,7 @@ export function ComposerPopoverAnchor(props: { readonly children: ReactNode }) {
28 };
29
30 // Measure every render: composer padding or expansion can move the anchor without resizing it.
31 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the anchor view after every commit and hands its popover content to the composer popover host
32 useEffect(() => {
33 measure();
34 host?.setContent(
@@ -50,6 +51,7 @@ export function ComposerPopoverAnchor(props: { readonly children: ReactNode }) {
51 });
52
53 const setHostContent = host?.setContent;
54 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the popover host's content and shared height value when the anchor unmounts
55 useEffect(
56 () => () => {
57 setHostContent?.(null);
apps/mobile/src/features/threads/ComposerPopoverAnchor.tsx
+1
@@ -6,6 +6,7 @@ import { useComposerPopoverHost } from "./ComposerPopoverHost";
6
7 export function ComposerPopoverAnchor(props: { readonly children: ReactNode }) {
8 const popoverHeight = useComposerPopoverHost()?.popoverHeight;
9 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- resets the popover host's shared height value when the anchor unmounts
10 useEffect(
11 () => () => {
12 popoverHeight?.set(0);
apps/mobile/src/features/threads/CustomSnoozeSheet.android.tsx
+1
@@ -61,6 +61,7 @@ function systemUses24HourClock() {
61 export function CustomSnoozeSheet(props: Props) {
62 const { themeAppearance, themeVariables: colors } = useAppearancePreferences();
63 const [is24Hour, setIs24Hour] = useState(systemUses24HourClock);
64 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to AppState to re-read the native 24-hour clock setting when the app resumes
65 useEffect(() => {
66 const subscription = AppState.addEventListener("change", (state) => {
67 if (state === "active") setIs24Hour(systemUses24HourClock());
apps/mobile/src/features/threads/HtmlRenderWebView.tsx
+1
@@ -95,6 +95,7 @@ export function HtmlRenderWebView(props: {
95 () => ({ uri: props.uri + htmlRenderThemeFragment(initialTheme) }),
96 [props.uri, initialTheme],
97 );
98 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- posts theme changes into the already loaded WebView
99 useEffect(() => {
100 if (shownTheme.current === null || shownTheme.current === theme) return;
101 shownTheme.current = theme;
apps/mobile/src/features/threads/McpAppFullscreenScreen.tsx
+1
@@ -106,6 +106,7 @@ export function McpAppFullscreenScreen({ route }: McpAppFullscreenScreenProps) {
106 const awaitingUser =
107 conversation?.hasPendingApprovals === true || conversation?.hasPendingUserInput === true;
108 // A request for the user is server state with no local handler to react in.
109 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- closes the focused screen through the navigator when the server asks the user for input or approval
110 useEffect(() => {
111 if (awaitingUser && focused && !exitPending.current) navigation.goBack();
112 }, [awaitingUser, focused, navigation]);
apps/mobile/src/features/threads/McpAppWebView.tsx
+3 -2
@@ -190,7 +190,7 @@ export function ThreadMcpApp(props: {
190 reopenDocument();
191 setPresentedFullscreen(false);
192 });
193 - // oxlint-disable-next-line t3code/react-effect-budget -- Navigation focus is outside React; listen only while the app is presented full screen, and stop on unmount.
193 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Navigation focus is outside React; listen only while the app is presented full screen, and stop on unmount.
194 useEffect(() => {
195 if (!presentedFullscreen) return;
196 return navigation.addListener("focus", () => returnedFromFullscreen());
@@ -237,6 +237,7 @@ export function ThreadMcpApp(props: {
237 // The attached WebView owns its host; state lets the tool-call effect pair
238 // a host only with an atom from a render after that host existed.
239 const [host, setHost] = useState<McpAppHost | null>(null);
240 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- resends host context to the MCP app host after commits that change theme, insets, tool or size
241 useEffect(() => {
242 const previous = latest.current;
243 latest.current = live;
@@ -255,7 +256,7 @@ export function ThreadMcpApp(props: {
256 // The host sends the call once the app initializes, so a stored item that
257 // lands late still reaches it. A completed call can arrive under a new
258 // revision, which is a new atom, so the host follows the current one.
258 - // oxlint-disable-next-line t3code/react-effect-budget -- subscribes the MCP host to the current tool call
259 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes the MCP host to the current tool call
260 useEffect(() => {
261 if (host === null) return;
262 return appAtomRegistry.subscribe(
apps/mobile/src/features/threads/NewTaskDraftRouteScreen.tsx
+1
@@ -161,6 +161,7 @@ export function NewTaskDraftRouteScreen({ route }: StaticScreenProps<NewTaskDraf
161 // Native-stack reads the provider's prevent state, which commits a render
162 // after usePreventRemove updates its registry; the deferred thread selection
163 // (and the failure goBack) must wait for that commit.
164 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- releases the branch checkout to its route once native-stack has committed the prevent-remove state
165 useEffect(() => {
166 if (checkoutKey === null || checkoutPending || removalBlocked) return;
167 branchCheckouts.release(checkoutKey);
apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
+3
@@ -370,6 +370,7 @@ export function NewTaskDraftScreen(props: {
370 (hasImportedIncomingShare && !incomingShare) ||
371 isIncomingShareUnavailable;
372 const appliedInitialProjectKeyRef = useRef<string | null>(null);
373 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- ends the picker return once the project arrives, else replaces the route with the picker next frame
374 useEffect(() => {
375 if (isReturningToProjectPicker && requestedInitialProjectAvailable) {
376 // oxlint-disable-next-line react/set-state-in-effect -- Ends the return-to-picker flow once the requested project arrives from the catalog.
@@ -396,6 +397,7 @@ export function NewTaskDraftScreen(props: {
397 const lastInitialProjectRefRef = useRef(props.initialProjectRef);
398 const initialPickerRef = useRef<"open" | "dismissed" | null>(null);
399
400 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- applies the route or catalog project to the draft once projects load, or opens the picker in the navigator
401 useEffect(() => {
402 if (props.draftId) {
403 return;
@@ -495,6 +497,7 @@ export function NewTaskDraftScreen(props: {
497 ]);
498
499 const { loadBranches } = flow;
500 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- requests the selected project's branch list from the server once per project
501 useEffect(() => {
502 if (!selectedProject) {
503 loadedBranchesProjectKeyRef.current = null;
apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
+1
@@ -271,6 +271,7 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps<NewTaskRoutePara
271 scratchStartInFlightRef.current = false;
272 }
273
274 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- navigates to the incoming share's reserved destination draft once its project loads and the screen is focused
275 useEffect(() => {
276 const destination = incomingShare?.destination;
277 if (!destination) {
apps/mobile/src/features/threads/QuestionAttachments.tsx
+2
@@ -50,6 +50,7 @@ export function QuestionAttachments(props: {
50 // The caller keys this component by request and question, so unmounting ends any open
51 // picker's scope.
52 const pickerScope = useRef<{ active: boolean }>({ active: false });
53 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens a scope that native picker and paste callbacks check, and closes it on unmount
54 useEffect(() => {
55 const scope = { active: true };
56 pickerScope.current = scope;
@@ -61,6 +62,7 @@ export function QuestionAttachments(props: {
62 const releaseFocus = useEffectEvent(() => {
63 if (focusedRef.current) onInputFocusChange?.(false);
64 });
65 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- releases keyboard ownership on unmount, since an unmounted native input never emits blur
66 useEffect(() => () => releaseFocus(), []);
67 const append = (
68 key: string,
apps/mobile/src/features/threads/ThreadArrangementSheet.tsx
+2
@@ -274,10 +274,12 @@ export function ThreadArrangementSheet(props: { onClose: () => void }) {
274 const orderVersion = rows
275 .map((row) => `${row.key}:${row.thread?.pinOrderKey}:${row.thread?.activeOrderKey}`)
276 .join("|");
277 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the in-progress drag gesture when the thread order changes underneath it
278 useEffect(() => {
279 // oxlint-disable-next-line react/exhaustive-effect-dependencies, react/set-state-in-effect -- A changed thread order cancels the in-progress drag and clears its preview; stop only touches refs and state setters.
280 stop();
281 }, [orderVersion]);
282 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the pending drag animation frame on unmount
283 useEffect(
284 () => () => {
285 if (frame.current !== null) cancelAnimationFrame(frame.current);
apps/mobile/src/features/threads/ThreadComposer.tsx
+3
@@ -605,8 +605,10 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
605 sendBlockedReason === null &&
606 !modelUnavailable;
607
608 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the workspace layout's composer-editing flag when the composer unmounts
609 useEffect(() => () => setComposerEditing(false), [setComposerEditing]);
610 // A pending sheet presentation or focus restore has no composer left to act on.
611 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- disposes the pending settings sheet presentation and focus restore on unmount
612 useEffect(() => () => disposeSettingsSheetPresentation(), []);
613
614 const onPressPreview = (source: FilePreviewSource) => {
@@ -722,6 +724,7 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
724 settingsSheetPresentation.onDismissed();
725 });
726
727 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to the native stack's finishTransitioning event to restore the keyboard after a sheet dismisses
728 useEffect(
729 () =>
730 // The native-stack patch exposes UIKit dismissal completion; restore the keyboard then.
apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+6
@@ -406,6 +406,7 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
406 // Android can lose IME hide callbacks on backgrounding. Quarantine translation on resume unless focused input retained its keyboard.
407 const [keyboardStateSuspect, setKeyboardStateSuspect] = useState(false);
408 const ownedInputFocusedRef = useRef(false);
409 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to AppState on Android to mark keyboard state suspect when the app resumes
410 useEffect(() => {
411 if (Platform.OS !== "android") {
412 return;
@@ -419,6 +420,7 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
420 subscription.remove();
421 };
422 }, []);
423 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the suspect flag whenever the native keyboard reports a visibility or height change
424 useEffect(() => {
425 // oxlint-disable-next-line react/set-state-in-effect -- Any native keyboard report clears the suspect flag set when the app resumed.
426 setKeyboardStateSuspect(false);
@@ -453,6 +455,7 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
455 const composerEditorRef = props.draftMode?.editorRef ?? defaultComposerEditorRef;
456 const isProviderSubagent = isProviderNativeSubagentThread(props.selectedThread.source);
457 const editingRunId = props.queuedRunEdit?.runId ?? null;
458 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- focuses the composer editor on the next animation frame when a queued run edit starts
459 useEffect(() => {
460 if (editingRunId === null) return;
461 const frame = requestAnimationFrame(() => composerEditorRef.current?.focus());
@@ -540,6 +543,7 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
543 props.serverConfig?.environment.capabilities.threadSnooze === true &&
544 effectiveSnoozed(props.selectedThread, { now: lifecycleNow });
545 const snoozedUntil = props.selectedThread.snoozedUntil;
546 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- arms a timer that refreshes the lifecycle clock when the thread's snooze expires
547 useEffect(() => {
548 if (!snoozed || snoozedUntil === null) return;
549 const timer = setTimeout(
@@ -743,6 +747,7 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
747 const loadEarlierForJump = useEffectEvent(() => {
748 if (jumpMessageId !== null) historyForJump?.onLoadThrough(jumpMessageId);
749 });
750 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- requests earlier history from the server until the jump target message loads, or ends the jump
751 useEffect(() => {
752 if (jumpMessageId === null || jumpMessageLoaded || contentPresentationKind !== "ready") return;
753 if (historyForJump?.loading) return;
@@ -1007,6 +1012,7 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
1012 setEndFollowEnabled(enabled);
1013 };
1014 // A jump this thread never reached lets go when it closes.
1015 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- aborts the thread scope, clears its timers and ends a pending message jump when the thread changes
1016 useEffect(() => {
1017 if (threadScope.current.signal.aborted) threadScope.current = new AbortController();
1018 const scope = threadScope.current;
apps/mobile/src/features/threads/ThreadFeed.tsx
+4 -1
@@ -2208,7 +2208,7 @@ export const ThreadFeed = memo(function ThreadFeed({
2208 props.threadId,
2209 props.contentPresentation.kind,
2210 ]);
2211 - // oxlint-disable-next-line react/exhaustive-effect-dependencies -- A scope change (thread or presentation) aborts the pending link lookup opened from the old scope.
2211 + // oxlint-disable-next-line react/exhaustive-effect-dependencies, t3code/no-unreasoned-state-sync -- A scope change (thread or presentation) aborts the pending link lookup opened from the old scope.
2212 useLayoutEffect(() => () => markdownLinkRequest.current?.abort(), [markdownLinkScope]);
2213 const [preview, setPreview] = useState<{
2214 readonly scope: string;
@@ -2782,6 +2782,7 @@ export const ThreadFeed = memo(function ThreadFeed({
2782 // Z: a native list scroll after the commit that rendered its target row. The
2783 // row is often already measured, so no LegendList callback fires for that
2784 // commit, and setEndFollow notifies the parent, so it can't run during render.
2785 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the native list to the jump target after the commit that rendered its row
2786 useEffect(() => {
2787 if (jumpIndex !== null) landJump(jumpIndex);
2788 // oxlint-disable-next-line react/exhaustive-effect-dependencies -- Jumping to a different message whose row index is unchanged must still land the jump.
@@ -2887,6 +2888,7 @@ export const ThreadFeed = memo(function ThreadFeed({
2888 }
2889
2890 // Timers and frames the feed schedules die with it.
2891 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the feed's scroll, reflow and copy timers and disclosure animation frames on unmount
2892 useEffect(
2893 () => () => {
2894 if (userScrollSettleTimerRef.current !== null) clearTimeout(userScrollSettleTimerRef.current);
@@ -3062,6 +3064,7 @@ export const ThreadFeed = memo(function ThreadFeed({
3064 const { textSizeKey } = workRowSizing;
3065 const hasHtmlRenders = presentedFeed.some((entry) => entry.type === "html-render");
3066 const previousRowGeometry = useRef({ textSizeKey, contentWidth });
3067 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears LegendList size caches and starts a reflow after the commit that brings new row geometry
3068 useLayoutEffect(() => {
3069 const previous = previousRowGeometry.current;
3070 if (previous.textSizeKey === textSizeKey && previous.contentWidth === contentWidth) return;
apps/mobile/src/features/threads/ThreadGuestShareBar.tsx
+1
@@ -70,6 +70,7 @@ export function ThreadGuestShareBar(props: {
70 // Keyed by the expiry, so a replaced link (even one already expired) gets its own timer.
71 const [expiredAt, setExpiredAt] = useState<string | null>(null);
72 const expiresAt = share?.expiresAt;
73 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- arms a timer that flips the share label when the guest link expires
74 useEffect(() => {
75 if (expiresAt === undefined) return;
76 const timer = setTimeout(
apps/mobile/src/features/threads/ThreadInlineFilePreview.tsx
+2
@@ -84,6 +84,7 @@ function InlineAudio(props: PreviewProps & { readonly resolveUri: () => Promise<
84 }, []);
85 useMediaAudioSessionHold(status.playing);
86 const fullscreenVideoOpen = useFullscreenVideoOpen();
87 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- drops the play request on fullscreen video, finish or error, and pauses the player for fullscreen
88 useEffect(() => {
89 if (fullscreenVideoOpen || status.didJustFinish || status.error) {
90 // oxlint-disable-next-line react/set-state-in-effect -- Native completion and fullscreen takeover invalidate the pending playback request.
@@ -91,6 +92,7 @@ function InlineAudio(props: PreviewProps & { readonly resolveUri: () => Promise<
92 }
93 if (fullscreenVideoOpen) pauseAudioPlayer(player);
94 }, [fullscreenVideoOpen, status.didJustFinish, status.error, player, requestPlayback]);
95 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to AppState to pause audio in the background and releases the audio session on cleanup
96 useEffect(() => {
97 active.current = true;
98 const subscription = AppState.addEventListener("change", (state) => {
apps/mobile/src/features/threads/ThreadQueueControl.tsx
+1
@@ -141,6 +141,7 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
141 const queuedRuns = workflow?.queuedRuns ?? [];
142
143 const hadQueuedRuns = useRef(queuedRuns.length > 0);
144 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pops the navigator once the server-side queue empties after it had runs
145 useEffect(() => {
146 if (queuedRuns.length > 0) {
147 hadQueuedRuns.current = true;
apps/mobile/src/features/threads/ThreadRouteScreen.tsx
+3 -1
@@ -213,7 +213,7 @@ function UnavailableThreadDraftRedirect(props: { readonly environmentId: Environ
213 }),
214 );
215 });
216 - // oxlint-disable-next-line t3code/react-effect-budget -- replaces this route in the navigator
216 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- replaces this route with a new draft thread route for the environment's project on mount
217 useEffect(() => {
218 openDraft();
219 }, []);
@@ -451,6 +451,7 @@ function ThreadRouteContent(
451 : chosenInspectorMode;
452 return mode === "files" && selectedThreadCwd === null ? null : mode;
453 })();
454 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- closes the workspace navigator's auxiliary pane when the thread has no cwd for the file inspector
455 useEffect(() => {
456 if (
457 props.inspectorPresentation === undefined &&
@@ -471,6 +472,7 @@ function ThreadRouteContent(
472 ]);
473
474 const revealPreview = useEffectEvent(() => showAuxiliaryPane("inspector"));
475 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens the workspace navigator's inspector pane when route params bring a preview target
476 useEffect(() => {
477 if (previewTarget) revealPreview();
478 }, [previewTarget]);
apps/mobile/src/features/threads/ThreadScreenHost.tsx
+2
@@ -65,6 +65,7 @@ export function ThreadScreenHost({ children }: { readonly children: ReactNode })
65
66 export function ThreadScreenBinding(props: ThreadDetailScreenProps) {
67 const store = useContext(ThreadScreenContext)!;
68 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes the route's thread screen props to the external store the outlet reads
69 useLayoutEffect(() => {
70 store.publish({ props });
71 });
@@ -79,6 +80,7 @@ export function ThreadScreenFallback({
80 readonly header?: ReactNode;
81 }) {
82 const store = useContext(ThreadScreenContext)!;
83 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes the fallback content and header to the external store the outlet reads
84 useLayoutEffect(() => {
85 store.publish({ fallback: children, header });
86 });
apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
+1
@@ -362,6 +362,7 @@ function ThreadSettingsSessionProvider(
362 favorites: legacyFavorites,
363 }).favorites;
364 const saveSettings = useAtomCommand(serverEnvironment.updateSettings, "model favorites update");
365 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- writes the one-time legacy model favorites migration to server settings once per connection
366 useEffect(() => {
367 if (
368 !props.environmentId ||
apps/mobile/src/features/threads/floating-working-control.tsx
+2
@@ -104,6 +104,7 @@ export function FloatingWorkingControl(props: {
104 );
105 const separationProgress = useSharedValue(props.showScrollToEnd ? 1 : 0);
106
107 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- animates the Reanimated separation value when scroll-to-end visibility changes
108 useEffect(() => {
109 separationProgress.set(withTiming(props.showScrollToEnd ? 1 : 0, CONTROL_TIMING));
110 }, [props.showScrollToEnd, separationProgress]);
@@ -133,6 +134,7 @@ export function FloatingWorkingControl(props: {
134 };
135 const hasStatus = props.status !== null;
136 const hasCapsule = hasStatus || hasQueue || hasAgents || hasPreview;
137 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the Reanimated capsule width value and measured width when the status goes away
138 useEffect(() => {
139 if (!hasStatus) {
140 measuredWidthRef.current = null;
apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
+1
@@ -66,6 +66,7 @@ export function GitOverviewSheet(props: GitOverviewSheetProps) {
66 const navigation = useNavigation();
67 const { environmentId, threadId } = props.route.params;
68 const isBlankLink = environmentId.trim().length === 0 || threadId.trim().length === 0;
69 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pops the navigator when the route link names a blank environment or thread
70 useEffect(() => {
71 if (isBlankLink) navigation.goBack();
72 }, [isBlankLink, navigation]);
apps/mobile/src/features/threads/new-task-flow-provider.tsx
+1
@@ -388,6 +388,7 @@ export function NewTaskFlowProvider(
388 })();
389
390 const selectedProjectDraftKey = selectedProject ? activeDraftKey : null;
391 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- creates the persistent draft in the new-task flow store once a project is selected, before the composer mounts
392 useEffect(() => {
393 // A route that names a draft binds that draft, or returns to the picker.
394 if (
apps/mobile/src/features/threads/thread-inspector-content-stack.tsx
+1
@@ -57,6 +57,7 @@ export function ThreadInspectorContentStack(props: {
57 () => new Set([props.mode]),
58 );
59
60 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- keeps opened UIKit inspector views mounted and prewarms the alternate inspector after a timer
61 useEffect(() => {
62 // oxlint-disable-next-line react/set-state-in-effect -- Keeps opened inspector views mounted so UIKit keeps their focus and scroll.
63 setMountedModes((current) => {
apps/mobile/src/features/threads/thread-work-log.tsx
+3
@@ -170,6 +170,7 @@ export function ThreadDisclosureChevron(props: {
170 const expandedAngle = props.collapsedDirection === "right" ? 90 : 180;
171 const rotation = useSharedValue(props.expanded ? expandedAngle : 0);
172
173 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- drives the chevron's Reanimated rotation value when the expanded state changes
174 useLayoutEffect(() => {
175 rotation.set(
176 withTiming(props.expanded ? expandedAngle : 0, {
@@ -278,6 +279,7 @@ export function ShimmeringWorkContent(props: {
279 // Runs on React Native's native driver instead of Reanimated, whose
280 // per-frame commits starve React's while commit pausing is disabled
281 // (package.json). See docs/internals/performance-regressions.md.
282 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- starts the native-driver shimmer loop while visible and active, and stops it on cleanup
283 useEffect(() => {
284 progress.setValue(0);
285 if (contentWidth <= 0 || reducedMotion || !appIsActive || !screenIsFocused) return;
@@ -672,6 +674,7 @@ function ThreadWorkGroupList(props: {
674 });
675 // Native ScrollView reports size after LegendList lays out rows. Use LegendList's JS size
676 // so group height and row measurements settle in the same commit.
677 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to LegendList's totalSize state to report content height in the same commit
678 useLayoutEffect(() => {
679 const list = listRef.current;
680 if (!list) return;
apps/mobile/src/features/threads/use-composer-command-menu.ts
+1
@@ -275,6 +275,7 @@ export function useComposerCommandMenu({
275 );
276 // Every draft change rechecks a stale snapshot, including drafts written by
277 // another surface (a prompt link) that never move the editor selection.
278 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- refreshes the provider workspace snapshot atom whenever the draft text changes from any surface
279 useEffect(() => {
280 refreshWorkspaceSnapshot();
281 }, [
apps/mobile/src/features/threads/useFileChipShare.ts
+1
@@ -22,6 +22,7 @@ export function useFileChipShare(
22 reportFailure: false,
23 });
24 const requestRef = useRef<AbortController | null>(null);
25 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- aborts the in-flight file share download when the component unmounts
26 useEffect(() => () => requestRef.current?.abort(), []);
27
28 return (target: FileChipTarget) => {
apps/mobile/src/features/voice-input/useVoiceInputController.ts
+1
@@ -27,6 +27,7 @@ export function useVoiceInputController(input: {
27 // oxlint-disable-next-line react/refs -- Transcription finishes asynchronously and must reach the composer's current selection setter, not the one captured at start.
28 latestInput.current = input;
29 const mounted = useRef(true);
30 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- tracks mount so async transcription results skip a composer that has unmounted
31 useEffect(() => {
32 mounted.current = true;
33 return () => {
apps/mobile/src/features/workspace/WorkspaceNativeTabs.ios.tsx
+1
@@ -36,6 +36,7 @@ function RetainedWorkspaceTab(props: {
36 const workspace = useWorkspaceTabs()!;
37 // Whether this slot is the visible one, read by cleanups after the switch has committed.
38 const activeRef = useRef(props.active);
39 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes the committed active flag to a ref that header cleanups read after the tab switch commits
40 useLayoutEffect(() => {
41 activeRef.current = props.active;
42 }, [props.active]);
apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx
+1
@@ -115,6 +115,7 @@ export function WorkspaceToolbar(props: {
115 return () => cancelAnimationFrame(frame);
116 }, [restoreSearch]),
117 );
118 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- schedules a frame to restore the native search bar's text and focus when its tab becomes active
119 useEffect(() => {
120 if (!tabActive) return;
121 const frame = requestAnimationFrame(restoreSearch);
apps/mobile/src/features/workspace/WorkspaceToolbar.tsx
+1
@@ -86,6 +86,7 @@ export function WorkspaceToolbar(props: {
86 else cancelSearch();
87 return true;
88 });
89 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- focuses the search TextInput after a focus request renders it
90 useEffect(() => {
91 if (focusRequest > 0) input.current?.focus();
92 }, [focusRequest]);
apps/mobile/src/lib/attachmentDocument.ts
+1
@@ -84,6 +84,7 @@ export function useAttachmentDocument(input: {
84 const kind = filePreviewKind(input, { richDocuments: false });
85 const delimiter = filePreviewDelimiter(input);
86 const shareController = useRef<AbortController | null>(null);
87 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- aborts the in-flight attachment share download when the component unmounts
88 useEffect(() => () => shareController.current?.abort(), []);
89 const resource = {
90 _tag: "attachment" as const,
apps/mobile/src/lib/backHandler.ts
+1 -1
@@ -10,7 +10,7 @@ import { BackHandler } from "react-native";
10 export function useHardwareBack(active: boolean, onBack: () => boolean) {
11 const focused = useIsFocused();
12 const handleBack = useEffectEvent(onBack);
13 - // oxlint-disable-next-line t3code/react-effect-budget -- subscribes to BackHandler for the focused screen's lifetime
13 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to BackHandler for the focused screen's lifetime
14 useEffect(() => {
15 if (!active || !focused) return;
16 const subscription = BackHandler.addEventListener("hardwareBackPress", () => handleBack());
apps/mobile/src/lib/previewPresentation.ts
+1 -1
@@ -25,7 +25,7 @@ export function usePreviewPresentation(
25 // can describe a different route. The preview belongs to this navigation route.
26 const navigation = useNavigation();
27 const close = useEffectEvent(onRequestClose);
28 - // oxlint-disable-next-line t3code/react-effect-budget -- Navigation blur is an external event and the open state belongs to the caller.
28 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Navigation blur is an external event and the open state belongs to the caller.
29 useEffect(() => {
30 if (presentationKey === null) return;
31 Keyboard.dismiss();
apps/mobile/src/lib/useMediaVideoPlayback.ts
+1
@@ -20,6 +20,7 @@ export function useMediaVideoPlayback(
20 const { isPlaying } = useEvent(player, "playingChange", { isPlaying: player.playing });
21 useMediaAudioSessionHold(isPlaying);
22
23 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to AppState for the player's lifetime and pauses the native player when unfocused or backgrounded
24 useEffect(() => {
25 active.current = focused && !paused && AppState.currentState === "active";
26 if (!active.current) interruption.current += 1;
apps/mobile/src/lib/videoAudioSession.ts
+1
@@ -56,6 +56,7 @@ export function useFullscreenVideoOpen(): boolean {
56 }
57
58 export function useMediaAudioSessionHold(active: boolean): void {
59 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- holds the shared native audio session while media plays and releases it on cleanup
60 useEffect(() => {
61 if (!active) return;
62 mediaPlaybackStarted();
apps/mobile/src/native/NativeHeaderToolbar.tsx
+2
@@ -244,6 +244,7 @@ function NativeHeaderToolbarRoot(props: {
244 }, [props.children, committedHandlers]);
245 // Native retains actions when unchanged presentation skips re-registration.
246 // Publish only committed handlers; abandoned renders must not replace them.
247 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes committed toolbar handlers to the ref native actions call; discarded renders must not leak
248 useLayoutEffect(() => {
249 committedHandlers.current = handlers;
250 return () => {
@@ -256,6 +257,7 @@ function NativeHeaderToolbarRoot(props: {
257 [items],
258 );
259
260 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears this placement's native header items through the navigator when the toolbar unmounts
261 useLayoutEffect(() => {
262 if (!setOptions) return;
263 return () => {
apps/mobile/src/native/StackHeader.tsx
+2
@@ -200,6 +200,7 @@ export function NativeStackScreenOptions(props: {
200 // phase: a render React discards must not leak its closures into the header.
201 // It runs before the tab check so wrappers already installed in an inactive
202 // tab's header still call the newest closures.
203 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- writes stabilized header options to the navigator after commit so discarded renders leave no closures
204 useLayoutEffect(() => {
205 const normalizedOptions = normalizeScreenOptions(props.options);
206 const stableOptions = normalizedOptions
@@ -236,6 +237,7 @@ export function NativeStackScreenOptions(props: {
237 );
238 }, [setOptions, props.options, props.optionsVersion, tabActive]);
239
240 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes the given listeners to navigator events for the screen's lifetime
241 useEffect(() => {
242 if (!navigation || !props.listeners) {
243 return;
apps/mobile/src/native/T3ComposerEditor.ios.tsx
+2
@@ -237,6 +237,7 @@ export function ComposerEditor({
237 mostRecentEventCount: controlledEventCount,
238 isNativeEcho,
239 });
240 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- prunes native editor event snapshots once a committed payload acknowledges them
241 useEffect(() => {
242 if (!acknowledgesLatestNativeEvent) return;
243 nativeEventSnapshotsRef.current = pruneAcknowledgedComposerNativeEvents(
@@ -245,6 +246,7 @@ export function ComposerEditor({
246 );
247 }, [acknowledgesLatestNativeEvent, mostRecentEventCount, nativeEventSnapshotsRef]);
248 const assumedValue = props.value;
249 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- records the committed controlled payload as the native editor's assumed state
250 useEffect(() => {
251 // Newer native events make this payload stale; do not record it as applied.
252 if (isNativeEcho || controlledEventCount !== mostRecentEventCountRef.current) return;
apps/mobile/src/native/T3ComposerEditor.native.tsx
+2
@@ -234,6 +234,7 @@ export function ComposerEditor({
234 mostRecentEventCount: controlledEventCount,
235 isNativeEcho,
236 });
237 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- prunes native editor event snapshots once a committed payload acknowledges them
238 useEffect(() => {
239 if (!acknowledgesLatestNativeEvent) return;
240 nativeEventSnapshotsRef.current = pruneAcknowledgedComposerNativeEvents(
@@ -242,6 +243,7 @@ export function ComposerEditor({
243 );
244 }, [acknowledgesLatestNativeEvent, mostRecentEventCount, nativeEventSnapshotsRef]);
245 const assumedValue = props.value;
246 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- records the committed controlled payload as the native editor's assumed state
247 useEffect(() => {
248 // Newer native events make this payload stale; do not record it as applied.
249 if (isNativeEcho || controlledEventCount !== mostRecentEventCountRef.current) return;
apps/mobile/src/native/V5StackHeader.ios.tsx
+1
@@ -270,6 +270,7 @@ export function V5StackHeader(props: {
270 const autofocusRef = searchOptions?.ref ?? searchRef;
271 // iOS ignores the native autoFocus prop, and SearchBar's imperative handle changes every
272 // commit, so a ref callback would refocus on each render; focus once after the header mounts.
273 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- schedules a frame to focus the native SearchBar once after the header mounts, since iOS ignores autoFocus
274 useEffect(() => {
275 if (!searchOptions?.autoFocus) return;
276 const frame = requestAnimationFrame(() => autofocusRef.current?.focus());
apps/mobile/src/native/useRetryingImageSource.ts
+1
@@ -11,6 +11,7 @@ import type { MarkdownImageSourceResolver } from "./SelectableMarkdownText.types
11 export function useRetryingImageSource(resolve: MarkdownImageSourceResolver | undefined) {
12 const latestRef = useRef(resolve);
13 const retriesRef = useRef(new Set<() => void>());
14 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes the committed resolver to a ref and retries images that failed under the previous one
15 useLayoutEffect(() => {
16 latestRef.current = resolve;
17 const retries = [...retriesRef.current];
apps/mobile/src/state/mediaActions.ts
+1
@@ -55,6 +55,7 @@ export function useMediaActions(source: MediaActionsSource | undefined, onOpenFi
55 );
56 const controller = useRef<AbortController | null>(null);
57 const [sharing, setSharing] = useState(false);
58 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- aborts the in-flight media share when the component unmounts
59 useEffect(() => () => controller.current?.abort(), []);
60
61 const share = () => {
apps/mobile/src/state/olderSettledShelf.ts
+2
@@ -39,6 +39,7 @@ export function useOlderSettledShelf(input: {
39 }));
40 const shelfKey = JSON.stringify(shelfScopes);
41 const shelf = useAtomValue(olderSettledThreads.shelfAtom(shelfScopes));
42 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- mounts older settled thread pages into the shared thread registry while the shelf shows them
43 useEffect(() => {
44 const releases = (JSON.parse(shelfKey) as typeof shelfScopes).flatMap(({ scope, pages }) =>
45 pages === 0
@@ -92,6 +93,7 @@ export function useOlderSettledShelfGrowth(
93 visibleCount: shelf.visibleCount,
94 });
95 const { grow, pages } = shelf;
96 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- requests more shelf pages when the loaded rows list fewer threads than the shelf shows
97 useEffect(() => {
98 if (wanted !== pages) grow(wanted);
99 }, [wanted, pages, grow]);
apps/mobile/src/state/peerLinks.ts
+1 -1
@@ -28,7 +28,7 @@ export function useLinkableMachines(environmentId: EnvironmentId, enabled: boole
28 const discoverIfUnasked = useEffectEvent(() => {
29 if (discovery.environments.size === 0 && !discovery.refreshing) void refreshDiscovery();
30 });
31 - // oxlint-disable-next-line t3code/react-effect-budget -- discovery follows the picker's visibility, which a card's mount or a dialog's open sets
31 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- discovery follows the picker's visibility, which a card's mount or a dialog's open sets
32 useEffect(() => {
33 if (enabled) discoverIfUnasked();
34 }, [enabled]);
apps/mobile/src/state/queries.ts
+2
@@ -89,6 +89,7 @@ export interface ComposerPathSearchTarget {
89 export function useDebouncedValue<A>(value: A, delayMs: number): A {
90 const [debounced, setDebounced] = useState(value);
91
92 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- timer that publishes the value after the delay and clears on change
93 useEffect(() => {
94 const timer = setTimeout(() => {
95 setDebounced(value);
@@ -227,6 +228,7 @@ export function useThreadSearch(
228 : { query: "", matches: EMPTY_THREAD_SEARCH_MATCHES };
229 // The shown results' rows stay mounted until newer results replace them.
230 const shownKey = visible.query === "" ? null : searchKeyOf(visible.query);
231 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- mounts the shown search results' rows into the shared thread registry until newer results replace them
232 useEffect(() => {
233 if (shownKey === null) return;
234 const environments = (JSON.parse(shownKey) as [ReadonlyArray<EnvironmentId>])[0];
apps/mobile/src/state/threads.ts
+1
@@ -51,6 +51,7 @@ export function useThreadFamily(
51 environmentId: EnvironmentId | null,
52 rootThreadId: ThreadId | null,
53 ): void {
54 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- mounts the subagent tree under the root thread into the shared thread registry while the caller shows it
55 useEffect(() => {
56 if (environmentId === null || rootThreadId === null) return;
57 return threadFamilies.mount(appAtomRegistry, environmentId, rootThreadId);
apps/mobile/src/state/use-composer-drafts.ts
+3
@@ -2038,6 +2038,7 @@ export function useComposerDraftSettings(draftKey: string | null): ComposerDraft
2038 const settings = useAtomValue(
2039 draftKey ? composerDraftSettingsAtom(draftKey) : EMPTY_DRAFT_SETTINGS_ATOM,
2040 );
2041 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- starts loading persisted composer drafts from native storage on first use
2042 useEffect(() => {
2043 ensureComposerDraftsLoaded();
2044 }, []);
@@ -2046,6 +2047,7 @@ export function useComposerDraftSettings(draftKey: string | null): ComposerDraft
2047
2048 export function useComposerDraft(draftKey: string | null): ComposerDraft {
2049 const draft = useAtomValue(draftKey ? composerDraftAtom(draftKey) : EMPTY_DRAFT_ATOM);
2050 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- starts loading persisted composer drafts from native storage on first use
2051 useEffect(() => {
2052 ensureComposerDraftsLoaded();
2053 }, []);
@@ -2054,6 +2056,7 @@ export function useComposerDraft(draftKey: string | null): ComposerDraft {
2056
2057 export function useStickyComposerModelSelection(): ModelSelection | null {
2058 const selection = useAtomValue(stickyComposerModelSelectionAtom);
2059 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- starts loading persisted composer drafts from native storage on first use
2060 useEffect(() => {
2061 ensureComposerDraftsLoaded();
2062 }, []);
apps/mobile/src/state/use-pull-to-refresh.ts
+1
@@ -10,6 +10,7 @@ export function usePullToRefresh<A, E>(atom: Atom.Atom<AsyncResult.AsyncResult<A
10 );
11 const [refreshingAtom, setRefreshingAtom] = useState<typeof atom>(null);
12 if (refreshingAtom !== null && refreshingAtom !== atom) setRefreshingAtom(null);
13 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- aborts the in-flight refresh for an atom when the atom changes or the component unmounts
14 useEffect(
15 () => () => {
16 if (request.current?.atom === atom) request.current.controller.abort();
apps/mobile/src/widgets/SubscriptionUsageCoordinator.tsx
+1
@@ -29,6 +29,7 @@ export function SubscriptionUsageCoordinator() {
29 const catalog = useAtomValue(environmentCatalog.catalogValueAtom);
30 const snapshot = useAtomValue(snapshotAtom);
31 const androidAppearance = Platform.OS === "android" ? themeAppearance : null;
32 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes subscription usage and theme to the native home screen widget
33 useEffect(() => {
34 if (!catalog.isReady || !appearanceReady) return;
35 void Promise.resolve()
apps/web/src/browser/BrowserSurfaceSlot.tsx
+1
@@ -77,6 +77,7 @@ export function BrowserSurfaceSlot(props: {
77 };
78 };
79
80 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes visibility, radius and stacking to the desktop browser surface after layout
81 useLayoutEffect(() => {
82 presentationRef.current = { visible, cornerRadius, zIndex };
83 updateRef.current?.();
apps/web/src/browser/HostedBrowserWebview.tsx
+6
@@ -105,6 +105,7 @@ export function HostedBrowserWebview(props: {
105 const serverColorScheme = serverRendering?.colorScheme;
106 const serverZoomFactor = serverRendering?.zoomFactor;
107
108 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- leases the desktop preview tab for this webview and releases it on cleanup
109 useEffect(() => {
110 if (!clientSettingsHydrated) return;
111 crashRecoveryRef.current = INITIAL_WEBVIEW_CRASH_RECOVERY_STATE;
@@ -119,11 +120,13 @@ export function HostedBrowserWebview(props: {
120 };
121 }, [clientSettingsHydrated, runtimeTabId, serverDriven, tabId, threadRef.threadId]);
122
123 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- applies the server color scheme to the desktop preview tab through the desktop bridge
124 useEffect(() => {
125 const bridge = window.desktopBridge?.preview;
126 if (!bridge || serverColorScheme === undefined) return;
127 withDesktopTab(runtimeTabId, () => bridge.setColorScheme(runtimeTabId, serverColorScheme));
128 }, [runtimeTabId, serverColorScheme]);
129 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- applies the server zoom factor to the desktop preview tab through the desktop bridge
130 useEffect(() => {
131 const bridge = window.desktopBridge?.preview;
132 if (!bridge || serverZoomFactor === undefined) return;
@@ -141,6 +144,7 @@ export function HostedBrowserWebview(props: {
144 webviewRef.current = node as ElectronWebview | null;
145 };
146
147 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- registers the webview's webContents with the desktop bridge and listens for crashes and focus
148 useEffect(() => {
149 const webview = webviewRef.current;
150 const bridge = previewBridge;
@@ -266,11 +270,13 @@ export function HostedBrowserWebview(props: {
270 });
271 };
272
273 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- schedules a frame that publishes the webview layout and scroll to the browser surface store
274 useEffect(() => {
275 const frameId = window.requestAnimationFrame(syncContentPresentation);
276 return () => window.cancelAnimationFrame(frameId);
277 }, [syncContentPresentation]);
278
279 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the webview wrapper element to its origin for a new tab or viewport size
280 useEffect(() => {
281 const wrapper = wrapperRef.current;
282 if (!wrapper) return;
apps/web/src/browser/ServerBrowserSurface.tsx
+4
@@ -308,6 +308,7 @@ export function ServerBrowserSurface(props: {
308 [pdfUrl, send],
309 );
310
311 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes the canvas container's size, sends resizes to the stream and grows the frame cap
312 useEffect(() => {
313 const element = canvasRef.current?.parentElement;
314 if (!element) return;
@@ -353,6 +354,7 @@ export function ServerBrowserSurface(props: {
354 };
355 }, [followSize]);
356
357 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens the preview stream client and paints its frames onto the canvas while visible
358 useEffect(() => {
359 const canvas = canvasRef.current;
360 if (!visible || accessDenied || hostSetup || !access || !cap || !canvas) return;
@@ -457,6 +459,7 @@ export function ServerBrowserSurface(props: {
459 visible,
460 ]);
461
462 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- registers a non-passive wheel listener on the canvas so it can stop the panel scrolling
463 useEffect(() => {
464 const canvas = canvasRef.current;
465 if (!canvas) return;
@@ -477,6 +480,7 @@ export function ServerBrowserSurface(props: {
480 return () => canvas.removeEventListener("wheel", onWheel);
481 }, [pagePoint, queueWheel]);
482
483 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the pending input animation frame when the component unmounts
484 useEffect(
485 () => () => {
486 if (inputFrameRef.current !== null) cancelAnimationFrame(inputFrameRef.current);
apps/web/src/browser/useBrowserViewportResize.ts
+2
@@ -60,6 +60,7 @@ export function useBrowserViewportResize(options: {
60 ? resolveBrowserDeviceViewportLayout(containerSize, effectiveViewport, zoomFactor)
61 : resolveBrowserViewportLayout(containerSize, effectiveViewport, zoomFactor);
62
63 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the drag and the keyboard commit timer when the component unmounts
64 useEffect(
65 () => () => {
66 dragVersionRef.current += 1;
@@ -73,6 +74,7 @@ export function useBrowserViewportResize(options: {
74 [],
75 );
76
77 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the pending keyboard viewport commit timer once the source viewport changes
78 useEffect(() => {
79 const pending = keyboardViewportRef.current;
80 if (!pending || pending.sourceKey === sourceViewportKey) return;
apps/web/src/cloud/managedAuth.tsx
+1
@@ -65,6 +65,7 @@ export function ManagedRelayAuthProvider({ children }: { readonly children: Reac
65 // ClerkProvider creates the Clerk instance and owns its lifetime, so the
66 // account service observes it for as long as this provider is mounted.
67 const clerk = useClerk();
68 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- attaches the Clerk instance to the managed relay account service for the provider's lifetime
69 useEffect(() => managedRelayAccountService.attach(clerk), [clerk]);
70 return children;
71 }
apps/web/src/commandPaletteStore.ts
+1 -1
@@ -33,7 +33,7 @@ export function isCommandPaletteMounted(): boolean {
33 * palette cannot stay open, so the last unmount resets the store.
34 */
35 export function useCommandPaletteMount(): void {
36 - // oxlint-disable-next-line t3code/react-effect-budget -- The palette's mount gates its global shortcuts, and leaving the route while it is open calls no close handler, so only unmount can reset the store.
36 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- The palette's mount gates its global shortcuts, and leaving the route while it is open calls no close handler, so only unmount can reset the store.
37 useEffect(() => {
38 mountedPalettes += 1;
39 return () => {
apps/web/src/components/AnimatedHeight.tsx
+2
@@ -16,6 +16,7 @@ export function AnimatedHeight({
16 readonly isClipping: boolean;
17 }>({ height: null, isClipping: false });
18
19 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- fallback timer that ends clipping when the height transition never reports its end
20 useEffect(() => {
21 if (!heightState.isClipping) return;
22 const timeoutId = window.setTimeout(() => {
@@ -30,6 +31,7 @@ export function AnimatedHeight({
31 heightState.isClipping,
32 ]);
33
34 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the content element and observes its size before paint to animate height
35 useLayoutEffect(() => {
36 if (holdHeight) return;
37 const element = contentRef.current;
apps/web/src/components/AnimatedWidth.tsx
+1
@@ -13,6 +13,7 @@ export function AnimatedWidth({
13 const contentRef = useRef<HTMLSpanElement>(null);
14 const [width, setWidth] = useState<number | null>(null);
15
16 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes the content element's width before paint to animate width
17 useLayoutEffect(() => {
18 const element = contentRef.current;
19 if (!element) return;
apps/web/src/components/AppSidebarLayout.tsx
+1
@@ -295,6 +295,7 @@ function SidebarControl() {
295 context: { usagePageOpen },
296 });
297
298 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window keydown listener that toggles the sidebar on its shortcut
299 useEffect(() => {
300 const onKeyDown = (event: KeyboardEvent) => {
301 if (event.defaultPrevented) return;
apps/web/src/components/BranchToolbarBranchSelector.tsx
+1
@@ -484,6 +484,7 @@ export function BranchToolbarBranchSelector({
484
485 // The server sets started threads' branches; defaulting here would detach the agent from its worktree.
486 const threadStarted = serverSession !== null;
487 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- writes a default base branch to the server thread or draft once branches load for a new worktree thread
488 useEffect(() => {
489 if (
490 threadStarted ||
apps/web/src/components/ChatMarkdown.tsx
+1
@@ -477,6 +477,7 @@ function useChatMarkdownState({
477 setLocalMedia(null);
478 }
479 // Layout cleanup blocks stale requests from reaching onImageExpand before paint.
480 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- layout cleanup invalidates media requests still loading for the old scope before paint
481 useLayoutEffect(
482 () => () => {
483 mediaRequestId.current += 1;
apps/web/src/components/ChatView.tsx
+17
@@ -416,6 +416,7 @@ export default function ChatView(props: ChatViewProps) {
416 const routeThreadRef = scopeThreadRef(environmentId, threadId);
417 const routeThreadKey = scopedThreadKey(routeThreadRef);
418 const currentRouteThreadKeyRef = useRef<string | null>(routeThreadKey);
419 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes the committed route thread key to a ref that async handlers check before applying results
420 useLayoutEffect(() => {
421 currentRouteThreadKeyRef.current = routeThreadKey;
422 return () => {
@@ -675,6 +676,7 @@ export default function ChatView(props: ChatViewProps) {
676 setIsWorkspaceFileDragActive(false);
677 }
678
679 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window dragend listener that clears the workspace file drag state
680 useEffect(() => {
681 if (!isWorkspaceFileDragActive) return;
682 const clearWorkspaceFileDrag = () => setIsWorkspaceFileDragActive(false);
@@ -980,6 +982,7 @@ export default function ChatView(props: ChatViewProps) {
982 );
983 const diffOpen = activeRightPanelKind === "diff";
984 const explicitDiffOpenRef = useRef<ScopedThreadRef | null>(null);
985 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- resets the diff panel store to branch scope when the diff opens without an explicit request
986 useLayoutEffect(() => {
987 const explicitThreadRef = explicitDiffOpenRef.current;
988 explicitDiffOpenRef.current = null;
@@ -1103,6 +1106,7 @@ export default function ChatView(props: ChatViewProps) {
1106 const handleFilePendingChangeStable = useStableCallback(handleFilePendingChange);
1107 const configuredPreviewUrls = getConfiguredPreviewUrls(activeProjectScripts);
1108
1109 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- drops file surfaces from the right panel store once bootstrap shows the thread has no workspace
1110 useEffect(() => {
1111 if (!activeThreadRef || !activeEnvironmentBootstrapComplete) return;
1112 useRightPanelStore.getState().reconcileFileSurfaces(activeThreadRef, activeProject !== null);
@@ -1618,6 +1622,7 @@ export default function ChatView(props: ChatViewProps) {
1622 payload: { answers: request.answers },
1623 })),
1624 );
1625 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- persists the server-reported resume compaction dismissal to localStorage
1626 useEffect(() => {
1627 if (nativeResumeCompactionDismissed && !resumeCompactionPermanentlyDismissed) {
1628 setResumeCompactionPermanentlyDismissed(true);
@@ -1647,6 +1652,7 @@ export default function ChatView(props: ChatViewProps) {
1652 const activeTerminalLaunchContext =
1653 terminalUiLaunchContext?.threadId === activeThreadId ? terminalUiLaunchContext : null;
1654 const liveIsGitRepo = gitStatusQuery.data?.isRepo;
1655 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- records live git repo status in the session cache read while the status query is unavailable
1656 useEffect(() => {
1657 if (gitStatusCwd !== null && liveIsGitRepo !== undefined) {
1658 rememberCheckoutIsRepo(environmentId, gitStatusCwd, liveIsGitRepo);
@@ -1777,6 +1783,7 @@ export default function ChatView(props: ChatViewProps) {
1783 }
1784 };
1785 const onInterruptStable = useStableCallback(onInterrupt);
1786 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window listener for the desktop snapshot event that focuses the composer
1787 useEffect(() => subscribeSnapShotComposerFocus(focusComposerStable), [focusComposerStable]);
1788 const scheduleComposerFocus = () => {
1789 window.requestAnimationFrame(() => {
@@ -1954,6 +1961,7 @@ export default function ChatView(props: ChatViewProps) {
1961 visiblePullRequestCount,
1962 onDiffPanelOpen,
1963 });
1964 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- consumes a pending maximize request from the right panel store once the panel can maximize
1965 useEffect(() => {
1966 if (!canMaximizeRightPanel) return;
1967 if (useRightPanelStore.getState().consumeMaximizeRequest(routeThreadRef)) {
@@ -2068,6 +2076,7 @@ export default function ChatView(props: ChatViewProps) {
2076 setTimelineAnchor,
2077 });
2078
2079 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- schedules a frame to focus the composer DOM element when a thread opens with the terminal closed
2080 useEffect(() => {
2081 if (!activeThread?.id || terminalUiState.terminalOpen) return;
2082 const frame = window.requestAnimationFrame(() => {
@@ -2078,6 +2087,7 @@ export default function ChatView(props: ChatViewProps) {
2087 };
2088 }, [activeThread?.id, focusComposerStable, terminalUiState.terminalOpen]);
2089
2090 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window focus listener that refocuses the composer after the window regains focus
2091 useEffect(() => {
2092 if (!activeThread?.id || terminalUiState.terminalOpen || isMobileViewport) return;
2093 let frame: number | null = null;
@@ -2235,6 +2245,7 @@ export default function ChatView(props: ChatViewProps) {
2245 composerRestingRef.current = resting;
2246 };
2247 const onComposerRestingChangeStable = useStableCallback(onComposerRestingChange);
2248 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the composer overlay element before paint for a new thread or composer mount
2249 useLayoutEffect(() => {
2250 if (!composerOverlayElement) return;
2251 composerTimelineInsetRef.current = 0;
@@ -2249,6 +2260,7 @@ export default function ChatView(props: ChatViewProps) {
2260 publishComposerOverlayHeightStable,
2261 ]);
2262
2263 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes the composer overlay element's size before paint and publishes its height
2264 useLayoutEffect(() => {
2265 if (!composerOverlayElement) return;
2266
@@ -2578,6 +2590,7 @@ export default function ChatView(props: ChatViewProps) {
2590 // Entering a thread with its drawer open focuses the drawer terminal; opening
2591 // it from a handler requests focus there. A closed drawer leaves focus to the
2592 // composer effect above.
2593 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- focuses the open drawer terminal when entering a thread
2594 useEffect(() => {
2595 if (activeThreadRef) return focusTerminalOnThreadEnter(activeThreadRef);
2596 }, [activeThreadRef]);
@@ -2657,6 +2670,7 @@ export default function ChatView(props: ChatViewProps) {
2670 });
2671
2672 // A focused desktop browser page forwards these chords as menu actions.
2673 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to desktop bridge menu actions that toggle the right panel
2674 useEffect(() => {
2675 return window.desktopBridge?.onMenuAction((action) => {
2676 if (action === "rightPanel.toggle") toggleRightPanelStable();
@@ -2870,6 +2884,7 @@ export default function ChatView(props: ChatViewProps) {
2884 threadKey: routeThreadKey,
2885 key: pendingGuestMessageKey,
2886 });
2887 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the timeline list to the end when a new pending guest message joins its footer
2888 useEffect(() => {
2889 const previous = previousPendingGuestMessagesRef.current;
2890 previousPendingGuestMessagesRef.current = {
@@ -2930,6 +2945,7 @@ export default function ChatView(props: ChatViewProps) {
2945 !activeEnvironmentUnavailable &&
2946 !activePendingProgress &&
2947 !feedbackUploading;
2948 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- switches the draft to local mode, then resends the waiting message once sending is idle
2949 useEffect(() => {
2950 if (
2951 !workLocallyResendReady ||
@@ -3023,6 +3039,7 @@ export default function ChatView(props: ChatViewProps) {
3039 const consumePendingFileDrop = useSidebarPendingFileDropStore(
3040 (state) => state.consumePendingFileDrop,
3041 );
3042 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- hands pending sidebar file drops to the composer's imperative API once it mounts
3043 useEffect(() => {
3044 if (pendingSidebarFileDrops.length === 0) return;
3045 if (
apps/web/src/components/CommandPalette.tsx
+1
@@ -702,6 +702,7 @@ function OpenCommandPaletteDialog(props: {
702 });
703 };
704
705 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- invalidates the browse navigation coordinator and in-flight clone lookups when the palette session unmounts
706 useEffect(
707 () => () => {
708 browseNavigation.invalidate();
apps/web/src/components/ComposerPromptEditorTiptap.tsx
+5
@@ -1445,11 +1445,13 @@ function ComposerPromptEditorTiptapInner(
1445 [],
1446 );
1447
1448 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes the disabled prop into the imperative Tiptap editor via setEditable
1449 useEffect(() => {
1450 editor?.setEditable(!disabled);
1451 }, [disabled, editor]);
1452
1453 // Push attributes before layout measurements; Tiptap updates them later in a passive effect.
1454 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes DOM attributes into the ProseMirror view before layout measurements read them
1455 useLayoutEffect(() => {
1456 if (!editor?.isInitialized) return;
1457 editor.view.setProps({ attributes: editorAttributes });
@@ -1510,6 +1512,7 @@ function ComposerPromptEditorTiptapInner(
1512
1513 // The one place the controlled value reaches the editor. Imperative handlers compare against
1514 // the committed value, so it is recorded here even before the editor exists.
1515 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- writes the controlled value and cursor into the Tiptap document before paint
1516 useLayoutEffect(() => {
1517 latestValueRef.current = value;
1518 if (!editor) return;
@@ -1594,6 +1597,7 @@ function ComposerPromptEditorTiptapInner(
1597 ]);
1598
1599 // Reconcile loaded or switched provider skills without rebuilding citation node views.
1600 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- replaces skill chip nodes in the Tiptap document when the provider skill list loads or changes
1601 useEffect(() => {
1602 if (!editor || literalText) return;
1603 const replacements = skillChipReplacements(editor.state.doc, (name) =>
@@ -1602,6 +1606,7 @@ function ComposerPromptEditorTiptapInner(
1606 if (replacements.length > 0) replaceSkillChips(editor, replacements);
1607 }, [editor, literalText, skills]);
1608
1609 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- restores ProseMirror focus and caret scroll when the keyed editor remounts, capturing focus on teardown
1610 useLayoutEffect(() => {
1611 if (!editor) return;
1612 if (restoreFocusRef.current) {
apps/web/src/components/CustomSnoozeDialog.tsx
+1
@@ -56,6 +56,7 @@ function startOfLocalDay(ms: number) {
56
57 export function CustomSnoozeDialogHost() {
58 const request = useRequest((state) => state.request);
59 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- resolves any pending snooze request promise with null when the dialog host unmounts
60 useEffect(() => () => finish(null), []);
61 return request ? <CustomSnoozeDialog /> : null;
62 }
apps/web/src/components/DiffPanel.tsx
+2
@@ -261,6 +261,7 @@ export default function DiffPanel({
261 return right.completedAt.localeCompare(left.completedAt);
262 });
263
264 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- rewrites the persisted diff store selection to the latest turn when the selected turn disappears
265 useEffect(() => {
266 if (!routeThreadRef || diffSelection.kind !== "turn") return;
267 useDiffPanelStore.getState().reconcileTurnSelection(
@@ -552,6 +553,7 @@ export default function DiffPanel({
553 // A file another view asked to reveal (a chat diff link): retried as the diff loads until it
554 // holds the file, then not again until a new request, so it does not undo what the user did since.
555 const externalRevealRef = useRef<string | null>(null);
556 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reveals an externally requested file in the diff viewer, retrying as the diff DOM loads
557 useEffect(() => {
558 if (!selectedFilePath) {
559 externalRevealRef.current = null;
apps/web/src/components/DiffWorkerPoolProvider.tsx
+1
@@ -94,6 +94,7 @@ function DiffWorkerReady({ children }: { children?: ReactNode }) {
94 ? readyPool === workerPool || workerPool.isInitialized() || !workerPool.isWorkingPool()
95 : typeof window === "undefined";
96
97 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- initializes the diff worker pool and marks it ready when its async startup settles
98 useEffect(() => {
99 if (ready || !workerPool) return;
100
apps/web/src/components/GitActionsControl.tsx
+1
@@ -1107,6 +1107,7 @@ export default function GitActionsControl({
1107 activeDraftThread?.envMode === "worktree" &&
1108 activeDraftThread.worktreePath === null;
1109
1110 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- persists the draft thread branch when the live git status subscription reports a different branch
1111 useEffect(() => {
1112 if (isGitActionRunning || isSelectingWorktreeBase || activeServerThread) {
1113 return;
apps/web/src/components/LegacySidebar.tsx
+2
@@ -3504,6 +3504,7 @@ export default function LegacySidebar({ routeReveal }: { routeReveal: SidebarRou
3504 event.stopPropagation();
3505 navigateToThread(scopeThreadRef(targetThread.environmentId, targetThread.id));
3506 });
3507 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to window keydown for thread navigation shortcuts for the sidebar's lifetime
3508 useEffect(() => {
3509 const handleWindowKeyDown = (event: globalThis.KeyboardEvent) => onWindowKeyDown(event);
3510 window.addEventListener("keydown", handleWindowKeyDown);
@@ -3512,6 +3513,7 @@ export default function LegacySidebar({ routeReveal }: { routeReveal: SidebarRou
3513 };
3514 }, []);
3515 // A window listener whose lifetime is the sidebar's: no element owns outside clicks.
3516 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window mousedown listener that clears thread selection on outside clicks for the sidebar's lifetime
3517 useEffect(() => {
3518 window.addEventListener("mousedown", clearThreadSelectionOnOutsideMouseDown);
3519 return () => window.removeEventListener("mousedown", clearThreadSelectionOnOutsideMouseDown);
apps/web/src/components/PersistentThreadTerminals.tsx
+1
@@ -162,6 +162,7 @@ export const PersistentThreadTerminalDrawer = memo(function PersistentThreadTerm
162 const storeCloseTerminal = useTerminalUiStateStore((state) => state.closeTerminal);
163 const reconcileTerminalIds = useTerminalUiStateStore((state) => state.reconcileTerminalIds);
164
165 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reconciles the terminal UI store's ids with the server's terminal list when they diverge
166 useEffect(() => {
167 if (terminalIdListsEqual(serverOrderedTerminalIds, terminalUiState.terminalIds)) {
168 return;
apps/web/src/components/ProjectCloneToastCoordinator.tsx
+2
@@ -88,6 +88,7 @@ function EnvironmentCloneToasts({ environmentId }: { environmentId: EnvironmentI
88 void handleNewThread(scopeProjectRef(environmentId, projectId));
89 };
90
91 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens, updates and closes imperative toastManager toasts to match the current project clones
92 useEffect(() => {
93 const seen = new Set<ProjectId>();
94 for (const clone of clones) {
@@ -215,6 +216,7 @@ function EnvironmentCloneToasts({ environmentId }: { environmentId: EnvironmentI
216 retryClone,
217 ]);
218
219 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- closes every tracked clone toast in toastManager when the coordinator unmounts
220 useEffect(
221 () => () => {
222 for (const tracked of toasts.current.values()) toastManager.close(tracked.toastId);
apps/web/src/components/ReopenClosedViewShortcut.tsx
+2
@@ -144,6 +144,7 @@ export function ReopenClosedViewShortcut() {
144 });
145 });
146
147 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to window keydown and the desktop menu action for the reopen closed view shortcut
148 useEffect(() => {
149 const onKeyDown = (event: KeyboardEvent) => {
150 if (
@@ -178,6 +179,7 @@ export function ReopenClosedViewShortcut() {
179 };
180 }, [keybindings, previewOpen, terminalOpen]);
181
182 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- registers forwarded shortcut chords with the desktop preview bridge and clears them on cleanup
183 useEffect(() => {
184 const preview = window.desktopBridge?.preview;
185 if (!preview?.setForwardedShortcuts) return;
apps/web/src/components/RightPanelTabs.tsx
+3
@@ -389,6 +389,7 @@ function RightPanelEmptyState(props: {
389 event.stopPropagation();
390 action.onClick();
391 });
392 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes a capture-phase window keydown listener for surface shortcuts while the menu is mounted
393 useEffect(() => {
394 const handler = (event: KeyboardEvent) => handleShortcut(event);
395 window.addEventListener("keydown", handler, true);
@@ -975,6 +976,7 @@ export function RightPanelTabs(props: RightPanelTabsProps) {
976 setAddSurfaceMenuOpen(true);
977 }
978 });
979 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes a document keydown listener for the new surface shortcut while the panel is open
980 useEffect(() => {
981 if (props.open === false) return;
982 document.addEventListener("keydown", onNewSurfaceKeyDown, true);
@@ -1181,6 +1183,7 @@ export function RightPanelTabs(props: RightPanelTabsProps) {
1183 });
1184
1185 // A newly active tab, or tabs that start overflowing, can sit outside the scrolled strip.
1186 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the active tab DOM node into view after it changes or the tab strip starts overflowing
1187 useEffect(() => {
1188 if (!props.activeSurfaceId || !tabScrollState.hasOverflow) return;
1189 const activeTab = tabListRef.current?.querySelector<HTMLElement>("[data-active-tab='true']");
apps/web/src/components/Sidebar.tsx
+6
@@ -1018,6 +1018,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
1018 // scope. Route changes arrive from history, links and the palette, and only this
1019 // component holds the project groups that decide a widening, so no single
1020 // navigation handler can make the write.
1021 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- writes a route reveal's widened project scope back to the persisted sidebar scope and clears selection
1022 useEffect(() => {
1023 if (!revealWidensScope) return;
1024 clearSelection();
@@ -1447,6 +1448,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
1448 }
1449 })();
1450 };
1451 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- registers this sidebar's settle handler in the module-level settleAndAdvance registry
1452 useEffect(() => registerSettleAndAdvance(attemptSettle), [attemptSettle]);
1453 const settleThreads = (threadKeys: readonly string[]) => {
1454 const coSettlingKeys = new Set(threadKeys);
@@ -1572,6 +1574,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
1574 };
1575 const dndSensors = useSensors(useSensor(SidebarPointerSensor, pointerSensorOptions));
1576 const sectionByThreadKeyRef = useRef(sectionByThreadKey);
1577 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes committed list data to refs read by stable drag and sweep callbacks
1578 useLayoutEffect(() => {
1579 projectGroupsRef.current = projectGroups;
1580 orderedThreadKeysRef.current = orderedThreadKeys;
@@ -1760,6 +1763,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
1763 // Update the local list too; threadByKey already omits rows moved into collapsed shelves.
1764 sidebarListItems = sidebarListItemsFresh;
1765 }
1766 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the dnd-kit drag sensor when the dragged row leaves the list
1767 useEffect(() => {
1768 if (
1769 dragState !== null &&
@@ -1778,6 +1782,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
1782 dragState === null && sidebarListItems.length + visibleDraftSessionCount > 0;
1783 // Cache on both fields so layout-key changes trigger the effect even when animate is unchanged.
1784 const listMotionPass = { layoutKey: listMotionLayoutKey, animate: listMotionAnimate };
1785 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- tells the list motion controller to animate or not after each layout-affecting commit
1786 useLayoutEffect(() => {
1787 listMotionRef.current?.update(listMotionPass.animate);
1788 }, [listMotionPass]);
@@ -2622,6 +2627,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
2627 ? selectThreadTerminalUiState(state.terminalUiStateByThreadKey, routeThreadRef).terminalOpen
2628 : false,
2629 );
2630 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to window keydown for thread navigation shortcuts using the current thread list
2631 useEffect(() => {
2632 const onWindowKeyDown = (event: KeyboardEvent) => {
2633 if (event.defaultPrevented || event.repeat || isCommandPaletteOpen() || isModelPickerOpen()) {
apps/web/src/components/ThreadRouteView.tsx
+1
@@ -89,6 +89,7 @@ export function ThreadRouteView({
89 });
90 const environmentHasAnyThreads = environmentThreadRefs.length > 0 || environmentHasDraftThreads;
91
92 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears pending file drops and navigates the router home once a server thread is confirmed missing
93 useEffect(() => {
94 if (target.kind !== "server" || !bootstrapComplete) {
95 return;
apps/web/src/components/ThreadTerminalDrawer.tsx
+6
@@ -616,6 +616,7 @@ function TerminalSessionViewport({
616 openTerminalLinkInPreview({ url, threadRef, openPreview, fallbackToBrowser, forceBrowser }),
617 );
618
619 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- sets the terminal input's readOnly from the operate grant and consumes a pending focus request
620 useLayoutEffect(() => {
621 if (terminalRef.current) terminalRef.current.input.readOnly = !canOperateTerminal;
622 if (canOperateTerminal && visibleRef.current)
@@ -624,12 +625,14 @@ function TerminalSessionViewport({
625
626 // Links re-read the grant on activation; only the hovered link's styling needs a nudge.
627 const linkActivationScopeRef = useRef(canOpenHostEditor);
628 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- refreshes link activation styling on the imperative terminal surface when the editor grant changes
629 useEffect(() => {
630 if (linkActivationScopeRef.current === canOpenHostEditor) return;
631 linkActivationScopeRef.current = canOpenHostEditor;
632 terminalRef.current?.refreshLinkActivation();
633 }, [canOpenHostEditor]);
634
635 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes visibility into the terminal surface before paint and consumes focus requests made while hidden
636 useLayoutEffect(() => {
637 visibleRef.current = visible;
638 terminalRef.current?.setVisible(visible);
@@ -637,6 +640,7 @@ function TerminalSessionViewport({
640 if (visible) consumePendingTerminalFocus(threadRef, terminalId);
641 }, [terminalId, threadRef, visible]);
642
643 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- applies font family and size changes to the live Ghostty terminal surface
644 useEffect(() => {
645 const current = terminalFontRef.current;
646 if (current.family === terminalFontFamily && current.size === terminalFontSize) return;
@@ -644,6 +648,7 @@ function TerminalSessionViewport({
648 void terminalRef.current?.setFont(terminalFontOptions(terminalFontFamily, terminalFontSize));
649 }, [terminalFontFamily, terminalFontSize]);
650
651 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- creates the Ghostty terminal in the mount node and subscribes it to the terminal session
652 useEffect(() => {
653 const mount = containerRef.current;
654 if (!mount) return;
@@ -1690,6 +1695,7 @@ export default function ThreadTerminalDrawer({
1695 if (heightBudgetChanged) setDrawerLayout(layout);
1696 },
1697 );
1698 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the drawer before visible paint and observes window and chat column resizes while visible
1699 useLayoutEffect(() => {
1700 if (!visible) {
1701 return;
apps/web/src/components/auth/ConnectAgentSurface.tsx
+1
@@ -93,6 +93,7 @@ export function ConnectAgentSurface() {
93 const [errorMessage, setErrorMessage] = useState("");
94 const [pending, setPending] = useState<"approve" | "deny" | null>(null);
95
96 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- fetches the MCP OAuth approval and redirects the window or stores details, ignoring stale answers
97 useEffect(() => {
98 let cancelled = false;
99 void runApproval((client) => client.mcpOAuth.approval({ payload: authorization })).then(
apps/web/src/components/auth/PairingRouteSurface.tsx
+2
@@ -71,6 +71,7 @@ export function PairingRouteSurface({
71 void submitCredential(token);
72 });
73
74 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- strips the pairing token from the URL and submits it once when the route carries one
75 useEffect(() => {
76 if (!autoPairToken || autoSubmitAttemptedRef.current) {
77 return;
@@ -194,6 +195,7 @@ export function HostedPairingRouteSurface() {
195 void submitHostedPairingRequest();
196 });
197
198 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- strips the pairing token from the URL and submits the hosted pairing request once on mount
199 useEffect(() => {
200 if (submitAttemptedRef.current) {
201 return;
apps/web/src/components/chat/AssistantCitationChip.tsx
+2
@@ -59,6 +59,7 @@ export function AssistantCitationChip({
59 const commentOpen = commentEditor?.open ?? false;
60 const sourceAnchor = commentEditor?.sourceAnchor;
61 const activeSourceAnchor = sourceAnchor === unavailableSourceAnchor ? undefined : sourceAnchor;
62 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- drops the uncommitted comment draft held in a ref once the parent closes the comment editor
63 useEffect(() => {
64 if (!commentOpen) draftCommentRef.current = null;
65 }, [commentOpen]);
@@ -79,6 +80,7 @@ export function AssistantCitationChip({
80 setUnavailableSourceAnchor(sourceAnchor);
81 }
82 });
83 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes the cited DOM source while the comment editor is open and reacts when it disappears
84 useEffect(() => {
85 if (!commentOpen || sourceAnchor === unavailableSourceAnchor) return;
86 const anchor = sourceAnchor ?? findAssistantCitationSourceAnchor(document, citation);
apps/web/src/components/chat/AssistantCitationSource.tsx
+1
@@ -348,6 +348,7 @@ export function AssistantCitationSource({
348 children: ReactNode;
349 }) {
350 const rootRef = useRef<HTMLDivElement>(null);
351 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes this message's DOM for a citation reveal request and scrolls the LegendList to it
352 useEffect(() => {
353 const root = rootRef.current;
354 const list = listRef.current;
apps/web/src/components/chat/AssistantSelectionToolbar.tsx
+2
@@ -36,6 +36,7 @@ export function AssistantSelectionToolbar({
36 const toolbarRef = useRef<HTMLButtonElement>(null);
37 const actionsRef = useRef<ReturnType<typeof observeSelectionActions> | null>(null);
38
39 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the toolbar DOM node and clamps its position inside the window before paint
40 useLayoutEffect(() => {
41 const toolbar = toolbarRef.current;
42 if (!toolbar || !selection) return;
@@ -44,6 +45,7 @@ export function AssistantSelectionToolbar({
45 toolbar.style.top = `${Math.max(8, Math.min(selection.position.y, window.innerHeight - rect.height - 8))}px`;
46 }, [selection]);
47
48 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to document selectionchange and keydown to track text selections in the viewport
49 useEffect(() => {
50 if (!viewport) return;
51 const clear = () => setSelection(null);
apps/web/src/components/chat/ChangedFilesTree.tsx
+1
@@ -261,6 +261,7 @@ function ChangedFilesRows({
261 const [range, setRange] = useState({ start: 0, end: 40, rowHeight: 28 });
262 const [focusedPath, setFocusedPath] = useState<string | null>(null);
263
264 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes scroll, window resize and ancestor resizes to compute the virtualized row range
265 useLayoutEffect(() => {
266 const container = containerRef.current;
267 const rowSize = rowSizeRef.current;
apps/web/src/components/chat/ChatCanvas.tsx
+1
@@ -29,6 +29,7 @@ export function ChatCanvas({
29 const [timelineElement, registerTimeline] = useState<HTMLElement | null>(null);
30 const measurements = useStore(store, (state) => state.measurements);
31 const detailsCardMeasurement = useStore(store, (state) => state.detailsCardMeasurement);
32 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes canvas, find bar and timeline resizes and writes the measurements to the canvas store
33 useLayoutEffect(() => {
34 const element = elementRef.current;
35 const probe = widthProbeRef.current;
apps/web/src/components/chat/ChatComposer.tsx
+24
@@ -653,6 +653,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
653 const isEditingQueuedMessage = editingQueuedAttachments !== null;
654 const composerDraft = useComposerThreadDraft(composerDraftTarget);
655 const composerDraftTargetKeyRef = useRef("");
656 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes the committed draft target key to a ref read by async handlers
657 useLayoutEffect(() => {
658 composerDraftTargetKeyRef.current = composerDraftTargetKey;
659 });
@@ -673,6 +674,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
674 !activePendingIsResponding;
675 const questionRequest = pendingUserInputs[0];
676 // Publish eligibility before async captures can observe a question the UI has already closed.
677 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- registers the open question's attachment draft in the module tracker before async captures read it
678 useLayoutEffect(() => {
679 if (!questionAttachmentTarget || !questionRequest || !questionTakesSnapShots) return;
680 return trackOpenQuestionAttachmentDraft(routeThreadRef, {
@@ -697,6 +699,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
699 const attachmentTargetKey = composerTargetKey(attachmentDraftTarget);
700 // Reject async imports after a draft switch.
701 const attachmentTargetKeyRef = useRef(attachmentTargetKey);
702 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes the committed attachment target key to a ref so async imports reject after a draft switch
703 useLayoutEffect(() => {
704 attachmentTargetKeyRef.current = attachmentTargetKey;
705 });
@@ -837,6 +840,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
840 );
841 const getComposerDraft = useComposerDraftStore((store) => store.getComposerDraft);
842
843 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- starts or releases server attachment uploads as upload capability, limits and draft attachments change
844 useEffect(() => {
845 if (!attachmentUploadsCapabilityKnown) {
846 return;
@@ -1079,10 +1083,12 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
1083 const composerScrollGestureRef = useRef(createComposerScrollGestureState());
1084 const pendingThreadImportsRef = useRef<Map<string, number>>(new Map());
1085 const isRevertingCheckpointRef = useRef(isRevertingCheckpoint);
1086 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes the committed checkpoint revert flag to a ref read by async handlers
1087 useLayoutEffect(() => {
1088 isRevertingCheckpointRef.current = isRevertingCheckpoint;
1089 });
1090
1091 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to window keydown, blur and the desktop paste-as-text event to arm plain-text paste
1092 useEffect(() => {
1093 const armPasteAsTextShortcut = () => {
1094 // Electron's menu action can precede paste; browsers deliver keydown first.
@@ -1175,6 +1181,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
1181 const activeComposerMenuItem =
1182 composerMenuItems.find((item) => item.id === activeComposerMenuItemId) ?? null;
1183
1184 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes committed composer menu state to refs read by editor key handlers
1185 useLayoutEffect(() => {
1186 composerMenuOpenRef.current = composerMenuOpen;
1187 composerMenuItemsRef.current = composerMenuItems;
@@ -1395,6 +1402,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
1402 addComposerFilesToDraft,
1403 });
1404
1405 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- keeps the shared prompt ref in step with the committed draft prompt for imperative handlers
1406 useEffect(() => {
1407 if (isLiteralPendingAnswer) return;
1408 promptRef.current = prompt;
@@ -1432,14 +1440,17 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
1440 setProviderInputSubmissionError(null);
1441 }
1442
1443 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- keeps the shared images ref in step with committed draft images for async handlers
1444 useEffect(() => {
1445 composerImagesRef.current = composerImages;
1446 }, [composerImages, composerImagesRef]);
1447
1448 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- keeps the shared files ref in step with committed draft files for async handlers
1449 useEffect(() => {
1450 composerFilesRef.current = composerFiles;
1451 }, [composerFiles, composerFilesRef]);
1452
1453 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- keeps the shared terminal contexts ref in step with committed draft contexts for async handlers
1454 useEffect(() => {
1455 composerTerminalContextsRef.current = composerTerminalContexts;
1456 }, [composerTerminalContexts, composerTerminalContextsRef]);
@@ -1458,6 +1469,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
1469 questionId: string | null;
1470 } | null>(null);
1471
1472 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- moves the prompt ref and caret to the end when the pending question or its answer changes externally
1473 useEffect(() => {
1474 const nextCustomAnswer = activePendingProgress?.customAnswer;
1475 if (typeof nextCustomAnswer !== "string") {
@@ -1521,6 +1533,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
1533 setIsComposerScrollCollapsed(false);
1534 }
1535
1536 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes composer form resizes to switch the footer and primary actions between compact layouts
1537 useLayoutEffect(() => {
1538 const composerForm = composerFormRef.current;
1539 if (!composerForm) return;
@@ -1557,6 +1570,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
1570 });
1571 }, [composerFooterHasWideActions]);
1572
1573 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reads draft images as data URLs and persists them to the draft store, dropping stale results on cleanup
1574 useEffect(() => {
1575 let cancelled = false;
1576 void (async () => {
@@ -2354,14 +2368,17 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
2368 if (composerControlsHidden && isComposerModelPickerOpen) {
2369 setIsComposerModelPickerOpen(false);
2370 }
2371 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reports whether resting controls show in the strip to ChatView before paint
2372 useLayoutEffect(() => {
2373 onRestingControlsVisibilityChange(composerControlsVisibleInStrip);
2374 }, [composerControlsVisibleInStrip, onRestingControlsVisibilityChange]);
2375 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reports the resting state to ChatView's ref before paint
2376 useLayoutEffect(() => {
2377 onRestingChange(isComposerResting);
2378 }, [isComposerResting, onRestingChange]);
2379 const [restingActionsElement, setRestingActionsElement] = useState<HTMLDivElement | null>(null);
2380 const [restingActionsWidth, setRestingActionsWidth] = useState<number | null>(null);
2381 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes resizes of the resting actions DOM node to measure its width
2382 useLayoutEffect(() => {
2383 if (!isComposerResting || !restingActionsElement) return;
2384 const measure = () => setRestingActionsWidth(restingActionsElement.offsetWidth);
@@ -2410,11 +2427,13 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
2427 setIsComposerScrollCollapsed(false);
2428 }
2429 const composerScrollCollapseEligible = canScrollCollapseComposer && !isComposerResting;
2430 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes the committed scroll-collapse eligibility to a ref read by the wheel listener
2431 useLayoutEffect(() => {
2432 composerScrollCollapseEligibleRef.current = composerScrollCollapseEligible;
2433 });
2434
2435 // Window activation re-fires focus; ignore that frame to keep the composer collapsed.
2436 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window focus listener and animation frame that ignore activation focus while the composer is collapsed
2437 useEffect(() => {
2438 if (!isComposerScrollCollapsed) return;
2439 let frame: number | null = null;
@@ -2434,6 +2453,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
2453 };
2454 }, [isComposerScrollCollapsed]);
2455
2456 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes a capture-phase document wheel listener that collapses the composer on timeline scroll
2457 useEffect(() => {
2458 if (!canTrackComposerScrollGesture) return;
2459
@@ -2772,6 +2792,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
2792 const setContextInsertionHandler = useComposerDraftStore(
2793 (store) => store.setContextInsertionHandler,
2794 );
2795 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- registers this composer's context insertion handler in the draft store for the current target
2796 useEffect(() => {
2797 return setContextInsertionHandler(composerDraftTarget, insertContextReferencesAtCaretStable);
2798 }, [composerDraftTarget, insertContextReferencesAtCaretStable, setContextInsertionHandler]);
@@ -2914,6 +2935,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
2935 };
2936
2937 // Escape can cancel without dragleave; clear highlights on bubbling dragend.
2938 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window dragend listener clears the drop highlight when a drag is cancelled without dragleave
2939 useEffect(() => {
2940 if (!isDragOverComposer) return;
2941 const onWindowDragEnd = () => {
@@ -2964,11 +2986,13 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
2986
2987 // Question dismissal unmounts focused controls without firing blur.
2988 const activePendingUserInputRequestId = activePendingUserInput?.requestId ?? null;
2989 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- schedules the collapse check after a dismissed question unmounts focused controls without a blur
2990 useEffect(() => {
2991 if (activePendingUserInputRequestId !== null) return;
2992 scheduleComposerCollapseCheckStable();
2993 }, [activePendingUserInputRequestId, scheduleComposerCollapseCheckStable]);
2994
2995 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels pending blur and mobile expand animation frames when the composer unmounts
2996 useEffect(() => {
2997 return () => {
2998 if (composerBlurFrameRef.current !== null) {
apps/web/src/components/chat/ChatHeader.tsx
+2
@@ -115,6 +115,7 @@ export const ChatHeader = memo(function ChatHeader({
115 ? renaming.title
116 : null;
117 const isRenamingTitle = renamingTitle !== null;
118 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the breadcrumb list DOM via ResizeObserver, a frame and font loads to collapse the parent title
119 useEffect(() => {
120 const list = breadcrumbContainerRef.current?.querySelector("ol");
121 if (!list || !parentThreadLink) return;
@@ -204,6 +205,7 @@ export const ChatHeader = memo(function ChatHeader({
205 clearTimeout(titleMenuTimerRef.current);
206 titleMenuTimerRef.current = null;
207 };
208 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the pending title-menu timer when the thread switches or the header unmounts
209 useEffect(
210 () => () => {
211 if (titleMenuTimerRef.current === null) return;
apps/web/src/components/chat/CommandOutputPanel.tsx
+1
@@ -40,6 +40,7 @@ export function CommandOutputPanel(props: {
40 const text = data?.output.text ?? "";
41 const { resolvedTheme } = useTheme();
42
43 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pins the output scroller's scrollTop to the bottom after each commit while the user follows
44 useLayoutEffect(() => {
45 const element = scrollRef.current;
46 if (element && followRef.current) element.scrollTop = element.scrollHeight;
apps/web/src/components/chat/ComposerAttachmentStrip.tsx
+1
@@ -81,6 +81,7 @@ function SnapShotAttachmentFrame({
81 }) {
82 const frameRef = useRef<HTMLDivElement>(null);
83
84 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the mounted tile into view and registers it as the SnapShot animation destination
85 useLayoutEffect(() => {
86 const frame = frameRef.current;
87 if (!frame || (!animationId && !arrival)) return;
apps/web/src/components/chat/ComposerBannerStack.tsx
+1
@@ -62,6 +62,7 @@ export function NoticeText({
62 const detailsRef = useRef<HTMLButtonElement>(null);
63 const [showDetails, setShowDetails] = useState(false);
64
65 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures text overflow in the DOM via ResizeObserver and MutationObserver to show the details button
66 useLayoutEffect(() => {
67 const text = textRef.current;
68 if (!text) return;
apps/web/src/components/chat/ComposerCommandMenu.tsx
+1
@@ -103,6 +103,7 @@ export const ComposerCommandMenu = memo(function ComposerCommandMenu(props: {
103 }) {
104 const listRef = useRef<HTMLDivElement>(null);
105
106 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the highlighted menu item's DOM node into view
107 useLayoutEffect(() => {
108 if (!props.activeItemId || !listRef.current) return;
109 const el = listRef.current.querySelector<HTMLElement>(
apps/web/src/components/chat/ComposerCommandMenuLayer.tsx
+1
@@ -24,6 +24,7 @@ export function ComposerCommandMenuLayer(props: {
24 }) {
25 const [position, setPosition] = useState<ComposerCommandMenuPosition | null>(null);
26
27 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- positions the menu from the composer's DOM rect, tracking window resize, scroll and ancestor resizes
28 useLayoutEffect(() => {
29 const anchor = props.anchor;
30 if (!anchor) return;
apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx
+2
@@ -115,6 +115,7 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard(
115 setOptimisticSingleSelect(null);
116 }
117
118 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the auto-advance timer when the question changes, input is disabled, or the panel unmounts
119 useEffect(() => {
120 const clearAutoAdvance = () => {
121 if (autoAdvanceTimerRef.current !== null) {
@@ -146,6 +147,7 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard(
147 const selectOptionFromShortcut = useEffectEvent(handleOptionSelection);
148 const backgroundThread = use(BackgroundThreadContext);
149
150 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes a document keydown listener for digit shortcuts while a question is answerable
151 useEffect(() => {
152 if (!activeQuestion || responseDisabled || isCollapsed || backgroundThread) return;
153 const handler = (event: globalThis.KeyboardEvent) => {
apps/web/src/components/chat/ComposerStashMenu.tsx
+1
@@ -111,6 +111,7 @@ export const ComposerStashMenu = memo(function ComposerStashMenu(props: {
111 }
112 });
113
114 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes capture-phase pointerdown and keydown listeners for outside close and keyboard navigation
115 useEffect(() => {
116 const onPointerDown = (event: PointerEvent) => closeOnOutsidePointer(event);
117 const onKeyDown = (event: KeyboardEvent) => handleKeyDown(event);
apps/web/src/components/chat/DraftHeroProjectHeading.tsx
+1
@@ -13,6 +13,7 @@ export function DraftHeroProjectHeading({
13 const inlineRef = useRef<HTMLSpanElement>(null);
14 const [fitsInline, setFitsInline] = useState(false);
15
16 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the heading against its container via ResizeObserver to choose inline or stacked layout
17 useLayoutEffect(() => {
18 const container = containerRef.current;
19 const inline = inlineRef.current;
apps/web/src/components/chat/HtmlRenderFrame.tsx
+1
@@ -59,6 +59,7 @@ export function HtmlRenderFrame(props: {
59 // Tied to the viewer's lifetime: unmounting while expanded must still release
60 // the timeline's follow pin, which a close handler alone never reaches.
61 const expanded = expandedSrc !== null;
62 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- holds the parent's fullscreen pin while expanded and releases it on collapse or unmount
63 useEffect(() => {
64 if (!expanded) return;
65 onFullscreenChange?.(true);
apps/web/src/components/chat/MarkdownCodeBlock.tsx
+1
@@ -331,6 +331,7 @@ function UncachedShikiCodeBlock({
331 const incrementalHighlight = preserveLines
332 ? createIncrementalHighlightedDocument(highlighter, language, themeName)
333 : null;
334 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- disposes the incremental Shiki highlighter when it is replaced or the block unmounts
335 useEffect(() => () => incrementalHighlight?.dispose(), [incrementalHighlight]);
336 const highlighted = (() => {
337 const result = (() => {
apps/web/src/components/chat/McpAppFrame.tsx
+2
@@ -391,11 +391,13 @@ export function McpAppFrame(props: {
391 };
392 };
393
394 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes theme, width, display mode and tool definition to the MCP app host in the iframe
395 useEffect(() => {
396 hostRef.current?.updateHostContext();
397 // oxlint-disable-next-line react/exhaustive-effect-dependencies -- Context changes trigger a resend.
398 }, [theme, width, displayMode, toolDefinition]);
399
400 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- sends the current tool call to the MCP app host, again for each new iframe document
401 useEffect(() => {
402 if (toolCall !== undefined) hostRef.current?.setToolCall(toolCall);
403 // oxlint-disable-next-line react/exhaustive-effect-dependencies -- Each new document needs the call.
apps/web/src/components/chat/MessagesTimeline.tsx
+2 -1
@@ -151,7 +151,7 @@ function TimelineListFooter({
151 readonly children?: ReactNode;
152 }) {
153 const contentRef = useRef<HTMLDivElement>(null);
154 - // oxlint-disable-next-line t3code/react-effect-budget -- reports growth of the footer's content, which the list does not follow
154 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reports growth of the footer's content, which the list does not follow
155 useLayoutEffect(() => {
156 const content = contentRef.current;
157 if (!content || !onGrow) return;
@@ -704,6 +704,7 @@ const ConversationTimeline = memo(function ConversationTimeline({
704 // must land before paint, after LegendList's own layout effects applied the
705 // new data. A citation request that arrives mid-restore takes over.
706 const { findOpenAtOpening } = identityChanged ? { findOpenAtOpening: findOpen } : listState;
707 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- restores LegendList's scroll position for the shown thread before paint, after the list's own layout
708 useLayoutEffect(() => {
709 const list = listRef.current;
710 const viewport = viewportRef.current;
apps/web/src/components/chat/ModelPickerContent.tsx
+2
@@ -282,6 +282,7 @@ function ModelPickerList({
282 setShowBottomScrollFade(itemKeys.length > 5);
283 }
284 const measureScrollFades = useEffectEvent(updateScrollFades);
285 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the list scroller in animation frames after a new list lays out to set scroll fades
286 useLayoutEffect(() => {
287 let nestedFrame = 0;
288 const frame = window.requestAnimationFrame(() => {
@@ -332,6 +333,7 @@ function ModelPickerList({
333 // Capture gives picker shortcuts priority over the composer.
334 function WindowKeyDownListener({ onKeyDown }: { onKeyDown: (event: KeyboardEvent) => void }) {
335 const handleKeyDown = useEffectEvent(onKeyDown);
336 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes a capture-phase window keydown listener for the picker's lifetime
337 useEffect(() => {
338 const listener = (event: KeyboardEvent) => handleKeyDown(event);
339 window.addEventListener("keydown", listener, true);
apps/web/src/components/chat/ModelPickerSidebar.tsx
+1
@@ -50,6 +50,7 @@ export const ModelPickerSidebar = memo(function ModelPickerSidebar(props: {
50 const [hoveredInstanceId, setHoveredInstanceId] = useState<ProviderInstanceId | null>(null);
51 const sidebarContentRef = useRef<HTMLDivElement>(null);
52 const [selectedIndicatorTop, setSelectedIndicatorTop] = useState<number | null>(null);
53 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reads the selected provider item's DOM offset to position the selection indicator
54 useLayoutEffect(() => {
55 const content = sidebarContentRef.current;
56 if (!content) {
apps/web/src/components/chat/OpenInPickerShortcut.ts
+1
@@ -52,6 +52,7 @@ export function useOpenFavoriteEditorShortcut({
52 const [preferredEditor] = usePreferredEditor(availableEditors);
53 const remote = useRemoteOpenState(environmentId);
54
55 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes a window keydown listener for the open-in-editor shortcut while enabled locally
56 useEffect(() => {
57 if (!enabled || remote.mode !== "local-exec") return;
58 const handler = (event: globalThis.KeyboardEvent) => {
apps/web/src/components/chat/ThreadActivityAnnouncer.tsx
+1
@@ -25,6 +25,7 @@ export const ThreadActivityAnnouncer = memo(function ThreadActivityAnnouncer({
25 const { regionRef, announce, clear } = useLiveRegion();
26 const memoryRef = useRef<{ threadKey: string; memory: ThreadAnnouncementMemory } | null>(null);
27
28 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- writes thread status changes to the aria-live region after commit
29 useEffect(() => {
30 if (threadKey === null) {
31 memoryRef.current = null;
apps/web/src/components/chat/ThreadDetailsCard.tsx
+2
@@ -48,6 +48,7 @@ export function ThreadDetailsCard({
48 // inline flag, which live in three stores, so no single write site sees the
49 // card leave popover mode. A flag left set would reopen the popover unasked
50 // when the card returns to popover mode.
51 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- closes the popover flag in the right panel store when the derived mode turns inline
52 useLayoutEffect(() => {
53 if (mode === "inline" && popoverOpen)
54 useRightPanelStore.getState().setThreadPanelOpen(threadRef, "popover", false);
@@ -56,6 +57,7 @@ export function ThreadDetailsCard({
57 const { environmentId, threadId } = threadRef;
58 // Re-measures when the density or measurement key changes, so each density's
59 // height is measured once it renders.
60 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the card's DOM height via ResizeObserver and reports it to the canvas
61 useLayoutEffect(() => {
62 const element = contentElement;
63 if (!element || density === "essential") return;
apps/web/src/components/chat/ThreadFindBar.tsx
+1
@@ -26,6 +26,7 @@ export const THREAD_FIND_BAR_RESERVED_HEIGHT = 36 + THREAD_DETAILS_CARD_GAP;
26 export function ThreadFindBar(props: ThreadFindBarProps) {
27 const inputRef = useRef<HTMLInputElement | null>(null);
28
29 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- focuses and selects the input DOM node when the bar opens or a find shortcut fires
30 useEffect(() => {
31 if (!props.open) return;
32 inputRef.current?.focus();
apps/web/src/components/chat/ThreadTimeline.tsx
+1
@@ -46,6 +46,7 @@ export function ThreadTimeline({
46 nextEntries: entries,
47 rememberedForActive: peekRememberedThreadTimeline<typeof entries>(activeThreadKey),
48 });
49 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- stores the committed ready timeline in the module-level cache used during thread switches
50 useLayoutEffect(() => {
51 if (detailLoading || entries.length === 0 || timelineHasEphemeralPreviewUrls(entries)) {
52 return;
apps/web/src/components/chat/TimelineWorkGroupRows.tsx
+2
@@ -200,6 +200,7 @@ function ExpandedWorkGroupEntries({
200 setRestoringPosition(false);
201 };
202
203 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes the list scroller and its content with ResizeObserver to update scroll fades
204 useLayoutEffect(() => {
205 const element = listRef.current?.getScrollableNode();
206 if (!element) return;
@@ -225,6 +226,7 @@ function ExpandedWorkGroupEntries({
226 setExpandedContentHeight(height);
227 };
228
229 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reads expanded row sizes from LegendList's measured state after layout
230 useLayoutEffect(updateExpandedContentHeight, [entries, updateExpandedContentHeight]);
231
232 return (
apps/web/src/components/chat/WorkLog.tsx
+1
@@ -139,6 +139,7 @@ export function WorkLogDetails({
139 }) {
140 const scrollerRef = useRef<HTMLDivElement>(null);
141 const atLiveEdgeRef = useRef(true);
142 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pins the scroller's scrollTop to the bottom after each commit while following live output
143 useLayoutEffect(() => {
144 const scroller = scrollerRef.current;
145 if (followLive && atLiveEdgeRef.current && scroller) {
apps/web/src/components/chat/composerContextUndo.ts
+1
@@ -48,6 +48,7 @@ export function useRetainedContextPayloads(draftTargetKey: string): RetainedCont
48 setDraft({ targetKey: draftTargetKey, payloads: createRetainedContextPayloads() });
49 }
50 const retained = draft.payloads;
51 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the retained payload maps when the draft target changes or the composer unmounts
52 useEffect(
53 () => () => {
54 for (const payloads of Object.values(retained)) payloads.clear();
apps/web/src/components/chat/threadContextDrag.ts
+1
@@ -10,6 +10,7 @@ export function useThreadContextDrop(
10 onDrop: (refs: ReadonlyArray<ScopedThreadRef>, isActive: () => boolean) => void,
11 ) {
12 const handleDrop = useEffectEvent(onDrop);
13 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes the target element to thread-context drop events and marks old drops inactive
14 useEffect(() => {
15 const target = targetRef.current;
16 if (!target) return;
apps/web/src/components/chat/threadFindHighlights.ts
+2
@@ -122,6 +122,7 @@ export function useThreadFindHighlights(input: {
122 // The observer repaints with whichever match is selected when text changes.
123 const readSelection = useEffectEvent(() => ({ activeRowId, activeOccurrence, onActiveRange }));
124
125 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- paints CSS Highlight ranges for the query, repainting on DOM mutations, and clears them on cleanup
126 useEffect(() => {
127 if (typeof CSS === "undefined" || !CSS.highlights || typeof Highlight === "undefined") {
128 readSelection().onActiveRange(null);
@@ -208,6 +209,7 @@ export function useThreadFindHighlights(input: {
209
210 // onActiveRange is read at paint time: its identity follows the caller's
211 // layout inputs, and repainting the active highlight for those is wasted work.
212 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- repaints the active CSS Highlight range when the selected match changes
213 useEffect(() => {
214 paintRef.current?.(rangesRef.current, {
215 activeRowId,
apps/web/src/components/chat/useAssistantCitationTarget.ts
+2
@@ -121,6 +121,7 @@ export function useAssistantCitationTarget({
121 // in a cleanup: StrictMode and <Activity> replay cleanups on a live activation.
122 // Unmounting needs no retire; the rows observing it unmount with the list.
123 const activatedRef = useRef<CitationNavigation | null>(null);
124 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- retires the replaced citation scroll and activates the new one, releasing the timeline follow
125 useEffect(() => {
126 if (activatedRef.current === current) return;
127 activatedRef.current?.retire();
@@ -129,6 +130,7 @@ export function useAssistantCitationTarget({
130 }, [current]);
131 // Escape and pointerdown dismiss before the viewport mounts; the viewport
132 // listeners join once it exists.
133 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes document and viewport listeners that dismiss the pending citation scroll
134 useEffect(() => current?.attachDismissal(viewport), [current, viewport]);
135
136 const settled = current !== null && settlement?.target === current.target ? settlement : null;
apps/web/src/components/chat/useAttachmentPreviewHandoff.ts
+1
@@ -37,6 +37,7 @@ export function useAttachmentPreviewHandoff(input: AttachmentPreviewHandoffInput
37 const handoffByMessageId = input.handoff;
38
39 // Blob URLs are a browser resource owned per thread; leaving the thread or the view ends them.
40 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- revokes the thread's blob preview URLs when the thread changes or the view unmounts
41 useEffect(() => () => blobPreviews.revokeThread(threadId), [blobPreviews, threadId]);
42
43 const serverAttachmentResources = selectHandoffImageResources(
apps/web/src/components/chat/useChatShortcuts.ts
+1
@@ -98,6 +98,7 @@ export function useChatShortcuts(input: ChatShortcutsInput) {
98 event.preventDefault();
99 input.closeThreadFind();
100 });
101 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- attaches window keydown listeners for chat shortcuts and find dismissal for the component's lifetime
102 useEffect(() => {
103 const onKeyDownCapture = (event: KeyboardEvent) => handleShortcut(event);
104 const onKeyDown = (event: KeyboardEvent) => dismissFind(event);
apps/web/src/components/chat/useComposerRestingTransition.ts
+5
@@ -90,6 +90,7 @@ export function useComposerRestingTransition(
90 clearOverlayPin();
91 };
92
93 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- mirrors the collapsed flag into a ref read by ResizeObserver callbacks and running animations
94 useLayoutEffect(() => {
95 isCollapsedRef.current = isCollapsed;
96 });
@@ -434,6 +435,7 @@ export function useComposerRestingTransition(
435 };
436 };
437
438 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- runs the FLIP animation against committed DOM geometry before paint when the collapsed state changes
439 useLayoutEffect(() => {
440 const requestId = transitionLayoutRequestRef.current + 1;
441 transitionLayoutRequestRef.current = requestId;
@@ -452,6 +454,7 @@ export function useComposerRestingTransition(
454 };
455 }, [isCollapsed, transitionToCurrentGeometry]);
456
457 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the committed overlay element and reports its height when the resting state changes
458 useLayoutEffect(() => {
459 if (previousRestingRef.current === isResting) return;
460 previousRestingRef.current = isResting;
@@ -460,6 +463,7 @@ export function useComposerRestingTransition(
463 if (overlay) onOverlayHeightChange(overlay.getBoundingClientRect().height);
464 }, [isResting, onOverlayHeightChange]);
465
466 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes composer and body resize to record geometry and retarget a running animation
467 useLayoutEffect(() => {
468 const element = elementRef.current;
469 if (!element) return;
@@ -504,6 +508,7 @@ export function useComposerRestingTransition(
508 });
509 }, [restingControlsRef, transitionToCurrentGeometry]);
510
511 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the cleanup timer, cancels Web Animations and strips inline transition styles on unmount
512 useEffect(() => {
513 hasCompletedInitialLayoutRef.current = true;
514 return () => {
apps/web/src/components/chat/useComposerSend.ts
+1
@@ -386,6 +386,7 @@ export function useComposerSend(input: ComposerSendInput) {
386 // A send awaits uploads before it declines, so it reads the approvals pending by then.
387 const pendingApprovalsRef = useRef(pendingApprovals);
388 const respondingRequestIdsRef = useRef(respondingRequestIds);
389 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- mirrors approvals into refs that an async send reads after awaiting uploads
390 useLayoutEffect(() => {
391 pendingApprovalsRef.current = pendingApprovals;
392 respondingRequestIdsRef.current = respondingRequestIds;
apps/web/src/components/chat/useComposerStash.ts
+1
@@ -694,6 +694,7 @@ export function useComposerStash(input: {
694 ).terminalOpen,
695 ),
696 }));
697 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- registers the capture-phase stash shortcut with the command registry while the composer is mounted
698 useEffect(() => {
699 if (backgroundThread) return;
700 return registerCommands(
apps/web/src/components/chat/useComposerTypingGuard.ts
+1
@@ -39,6 +39,7 @@ export function useComposerTypingGuard(scope: string, requestIds: readonly strin
39 const onFocus = () => dispatch({ type: "focus" });
40 const onBlur = () => dispatch({ type: "blur" });
41 const onSend = () => dispatch({ type: "send" });
42 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- schedules a timer that releases held requests once typing has been idle long enough
43 useEffect(() => {
44 if (state.held.size === 0) return;
45 const timeout = window.setTimeout(
apps/web/src/components/chat/useDraftEnvironmentRouting.ts
+3
@@ -111,6 +111,7 @@ export function useDraftEnvironmentRouting(input: DraftEnvironmentRoutingInput)
111 loadBalancingCandidates,
112 loadBalancingSettings.loadBalancingWeights,
113 );
114 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- writes the resolved load-balanced environment into the draft store once the async pick settles
115 useEffect(() => {
116 if (!needsLoadBalancing || loadBalancing.pending || !draftId || sendInFlightRef.current) return;
117 const target = logicalProjectEnvironments.find(
@@ -171,10 +172,12 @@ export function useDraftEnvironmentRouting(input: DraftEnvironmentRoutingInput)
172 readonly scope: string;
173 } | null>(null);
174 const environmentChangeScopeRef = useRef("");
175 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- mirrors the current change scope into a ref that async environment switches compare against
176 useLayoutEffect(() => {
177 environmentChangeScopeRef.current = environmentChangeScope;
178 });
179 // Leaving the scope, or unmounting, abandons a change still in flight.
180 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- abandons an in-flight environment change when the draft or project scope changes or unmounts
181 useLayoutEffect(
182 () => () => {
183 if (environmentChangeRef.current?.scope === environmentChangeScope) {
apps/web/src/components/chat/useDraftHeroLayoutTransition.ts
+1
@@ -19,6 +19,7 @@ export function useDraftHeroLayoutTransition(
19 previousComposerRectRef.current = composerAnchorRef.current?.getBoundingClientRect() ?? null;
20 });
21
22 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the committed composer rect and starts a FLIP Web Animation before paint
23 useLayoutEffect(() => {
24 const transitionGroup = transitionGroupRef.current;
25 const nextComposerRect = composerAnchorRef.current?.getBoundingClientRect() ?? null;
apps/web/src/components/chat/usePasteToFocusComposer.ts
+1
@@ -16,6 +16,7 @@ export function usePasteToFocusComposer(
16 composerRef: ComposerHandleRef,
17 ) {
18 const pasteAsTextShortcutUntilRef = useRef(0);
19 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- attaches window keydown and paste capture listeners that route stray pastes into the composer
20 useEffect(() => {
21 const keyHandler = (event: KeyboardEvent) => {
22 if (
apps/web/src/components/chat/useRestingComposerControlsLayout.ts
+1
@@ -45,6 +45,7 @@ export function useRestingComposerControlsLayout(
45 });
46 };
47
48 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes control resize, DOM mutations and font loading to measure which controls fit
49 useLayoutEffect(() => {
50 const currentHost = useControlsAsHost ? controls : host;
51 if (!currentHost || !controls) return;
apps/web/src/components/chat/useRightPanelActions.ts
+1
@@ -289,6 +289,7 @@ export function useRightPanelActions(input: RightPanelActionsInput) {
289 onDiffPanelOpen?.();
290 };
291 const onOpenTurnDiffStable = useStableCallback(onOpenTurnDiff);
292 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to the preview action bus to toggle the preview panel
293 useEffect(
294 () =>
295 subscribePreviewAction((action) => {
apps/web/src/components/chat/useThreadFind.ts
+3
@@ -180,11 +180,13 @@ export function useThreadFind({
180 }));
181 }
182 });
183 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reruns a live refresh that was coalesced behind a server search once that search settles
184 useEffect(() => {
185 if (!refreshAfterSearchRef.current || remote.isPending) return;
186 refreshAfterSearchRef.current = false;
187 if (!remote.error) refreshLiveResults();
188 }, [remote.isPending, remote.error]);
189 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- starts a debounce timer to refresh find results when streamed thread content changes
190 useEffect(() => {
191 if (lastContentRef.current === content) return;
192 lastContentRef.current = content;
@@ -194,6 +196,7 @@ export function useThreadFind({
196 refreshLiveResults();
197 }, 300);
198 }, [content, isOpen, state.query]);
199 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the pending refresh timer when the thread, open state or query changes
200 useEffect(() => {
201 if (!isOpen || threadKey === null || !state.query.trim()) return;
202 return () => {
apps/web/src/components/chat/useThreadFindNavigation.ts
+3
@@ -226,6 +226,7 @@ export function useThreadFindNavigation({
226 // scroll time; the viewport ref callback in MessagesTimeline cannot read
227 // them without a latest-ref mirror, and capturing them would re-attach the
228 // viewport (observers, citation dismissal) on every streamed entry.
229 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- attaches a scroll listener to the timeline container to track the active match position
230 useEffect(() => {
231 if (!container) return;
232 const onScroll = () => {
@@ -250,6 +251,7 @@ export function useThreadFindNavigation({
251 key: null,
252 pages: new Set(),
253 });
254 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- requests earlier history pages until the active match's entry is loaded
255 useEffect(() => {
256 if (requestedPagesRef.current.key !== matchKey)
257 requestedPagesRef.current = { key: matchKey, pages: new Set() };
@@ -282,6 +284,7 @@ export function useThreadFindNavigation({
284 // Positioning also depends on the list: a loaded page or a shifted row must
285 // retry the jump for the same selection. Declared after the highlight
286 // effects so it reuses the range they just resolved.
287 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the list to the active match after commit when rows or the loaded page change
288 useEffect(() => {
289 reveal(stateRef.current.activeRange, {
290 matchKey,
apps/web/src/components/chat/useThreadFindPositionReader.ts
+1
@@ -37,6 +37,7 @@ export function useThreadFindPositionReader({
37 readonly contentInsetEndAdjustment: number;
38 }) {
39 // Layout effect so a find opened right after a thread switch reads this viewport.
40 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- attaches the timeline viewport's position reader to the thread find registry
41 useLayoutEffect(() => {
42 if (!timelineViewportElement) return;
43 const read: ThreadFindPositionReader = (query) => {
apps/web/src/components/chat/useTimelineFollow.ts
+2 -1
@@ -358,7 +358,7 @@ export function useTimelineFollow(input: TimelineFollowInput) {
358 // The list does not follow footer layout, so the resting composer cannot scroll it. Growth
359 // above the composer (a new notice) would cover the last rows instead.
360 const followedInsetRef = useRef(composerTimelineInset);
361 - // oxlint-disable-next-line t3code/react-effect-budget -- scrolls the list after its bottom inset grows
361 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the list after its bottom inset grows
362 useLayoutEffect(() => {
363 const grew = composerTimelineInset > followedInsetRef.current;
364 followedInsetRef.current = composerTimelineInset;
@@ -552,6 +552,7 @@ export function useTimelineFollow(input: TimelineFollowInput) {
552 // the anchored end space; the trigger is streamed thread data. A
553 // totalSize listener cannot replace it: the anchored end space can already
554 // be 0, so dropping it changes no size and no list event fires.
555 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the timeline to the end after the commit that drops anchored end space
556 useLayoutEffect(() => {
557 if (timelineAnchorMessageId === null || !timelineLiveFollowEnabled) return;
558 if (
apps/web/src/components/cloud/CloudEnvironmentConnectList.tsx
+3
@@ -123,6 +123,7 @@ export function CloudEnvironmentConnectRows({
123 .map((environment) => environment.environmentId),
124 );
125
126 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- fetches relay discovery when its inputs change, unless hidden polling covers it, and reports readiness
127 useEffect(() => {
128 let active = true;
129 if (onDiscoveryReady || !refreshWhileEmpty || document.visibilityState === "visible") {
@@ -220,6 +221,7 @@ export function CloudEnvironmentConnectRows({
221 }
222 },
223 );
224 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- auto-selects newly discovered machines from the discovery store and starts their relay connections
225 useEffect(() => {
226 // oxlint-disable-next-line react/set-state-in-effect -- Discovery results arrive from an external store and auto-selection starts relay connections, which mark themselves connecting.
227 selectNewComputers(environmentsState.environments);
@@ -229,6 +231,7 @@ export function CloudEnvironmentConnectRows({
231 const shouldRefreshWhileEmpty =
232 refreshWhileEmpty && visibleEnvironments.length === 0 && !environmentsState.offline;
233
234 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- polls relay discovery on a timer, focus and visibility change while no machine is found
235 useEffect(() => {
236 if (!shouldRefreshWhileEmpty) return;
237 let timer: ReturnType<typeof setTimeout> | undefined;
apps/web/src/components/cloud/ConnectCliAuthSurface.tsx
+1
@@ -38,6 +38,7 @@ export function ConnectCliAuthorizeSurface() {
38 };
39 const openSignInOnLoad = useEffectEvent(openSignIn);
40
41 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens Clerk sign-in or navigates the window to the authorize URL once Clerk has loaded
42 useEffect(() => {
43 if (!request || !isLoaded || redirecting.current) {
44 return;
apps/web/src/components/contextChipParts.tsx
+1
@@ -252,6 +252,7 @@ function SvgFileChip(props: ComponentProps<typeof FileChip>) {
252 }
253 : null,
254 );
255 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- creates an object URL for the local SVG file and revokes it on cleanup
256 useEffect(() => {
257 const file = preview?.file;
258 if (!file) return;
apps/web/src/components/desktop/DesktopAppActivationCoordinator.tsx
+1
@@ -71,6 +71,7 @@ export function DesktopAppActivationCoordinator() {
71 }),
72 );
73
74 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to desktop activation requests over the bridge and marks the renderer ready
75 useEffect(() => {
76 if (!ready || activation === undefined) return;
77
apps/web/src/components/desktop/DesktopWebLinkCoordinator.tsx
+1
@@ -163,6 +163,7 @@ export function DesktopWebLinkCoordinator() {
163 });
164 });
165
166 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to desktop web link opens over the bridge and marks the renderer ready
167 useEffect(() => {
168 if (!ready || webLinks === undefined) return;
169 let subscribed = true;
apps/web/src/components/desktop/SnapShotCoordinator.tsx
+2
@@ -470,6 +470,7 @@ export function SnapShotCoordinator() {
470 }
471 },
472 );
473 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to SnapShot events from the desktop bridge and drains pending ones while enabled
474 useEffect(() => {
475 const bridge = getDesktopSnapShotBridge();
476 if (!bridge || !enabled) return;
@@ -477,6 +478,7 @@ export function SnapShotCoordinator() {
478 return bridge.onSnapShotEvent((event) => handleSnapShotEvent(bridge, event));
479 }, [enabled]);
480
481 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- attaches window blur, focus and visibilitychange listeners to dismiss or drain SnapShot animations
482 useEffect(() => {
483 const dismissOnBlur = () => {
484 pendingAnimationStartsRef.current.clear();
apps/web/src/components/device/DeviceDuoViewport.tsx
+2
@@ -39,6 +39,7 @@ export function DeviceDuoViewport(props: {
39 onFrameListener,
40 } = props;
41
42 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- stores screen and model in refs, ends any active interaction, and pushes the screen into the 3D Duo viewer
43 useEffect(() => {
44 screenRef.current = props.screen;
45 modelRef.current = props.model;
@@ -46,6 +47,7 @@ export function DeviceDuoViewport(props: {
47 viewerRef.current?.setScreen(props.screen);
48 }, [props.screen, props.model]);
49
50 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes the hinge preview into the imperative 3D Duo viewer unless a pinch is active
51 useEffect(() => {
52 previewRef.current = props.hingePreview;
53 if (!pinchRef.current?.active) viewerRef.current?.setHingePreview(props.hingePreview);
apps/web/src/components/device/DevicePhoneViewport.tsx
+2
@@ -33,11 +33,13 @@ export function DevicePhoneViewport(props: {
33 const accessoryRef = useRef(props.accessory);
34 const { source, onFrameListener, client, onInputCancel, onResetReady, onUnavailable } = props;
35
36 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes the fold angle into the imperative 3D phone viewer
37 useEffect(() => {
38 foldAngleRef.current = props.foldAngle;
39 viewerRef.current?.setFoldAngle(props.foldAngle);
40 }, [props.foldAngle]);
41
42 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes screen, profile, model and accessory changes into the imperative 3D phone viewer
43 useEffect(() => {
44 screenRef.current = props.screen;
45 profileRef.current = props.profile;
apps/web/src/components/diffs/DiffCommentAnnotation.tsx
+1
@@ -47,6 +47,7 @@ export function DiffCommentAnnotation({
47 const trimmedText = displayedText.trim();
48 const textareaRef = useRef<HTMLTextAreaElement | null>(null);
49
50 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- focuses the draft textarea on the next animation frame after mount
51 useLayoutEffect(() => {
52 if (kind !== "draft" || !focusOnMount) return;
53 const frame = window.requestAnimationFrame(() => {
apps/web/src/components/diffs/DiffFileLoadingBoundary.tsx
+1
@@ -17,6 +17,7 @@ export function DiffFileLoadingBoundary({ load, count }: { load: () => void; cou
17 };
18 // A settled batch shrinks `count` without moving the boundary out of range, and no new
19 // intersection entry arrives for that, so ask for the next batch whenever it changes.
20 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- requests the next diff batch while the boundary is near the viewport and files remain
21 useEffect(() => {
22 if (isNear && count > 0) loadLatest();
23 }, [isNear, count, loadLatest]);
apps/web/src/components/diffs/DiffFileTree.tsx
+3
@@ -95,10 +95,12 @@ export function DiffFileTree({
95 areAllDirectoriesExpanded(currentModel, directoryPaths),
96 );
97
98 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes the icon set into the imperative Pierre file tree model
99 useEffect(() => {
100 model.setIcons(icons);
101 }, [icons, model]);
102
103 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- applies path updates, ordering and git status to the imperative Pierre file tree model
104 useEffect(() => {
105 ordering.update(positions);
106 const mounted = mountedPresentationRef.current;
@@ -144,6 +146,7 @@ export function DiffFileTree({
146 model.setGitStatus(gitStatus);
147 }, [directoryPaths, gitStatus, model, modelPaths, ordering, positions, presented]);
148
149 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- expands ancestors, selects and scrolls to the requested file in the Pierre tree model
150 useEffect(() => {
151 if (selectedPath === null) {
152 handledRevealRef.current = null;
apps/web/src/components/files/AttachmentFilePreview.tsx
+3
@@ -139,6 +139,7 @@ export function AttachmentFilePreview(props: {
139 const [contentError, setContentError] = useState<string | null>(null);
140 const copyContents = useRef<(() => Promise<string>) | null>(null);
141 const authorizedAt = useRef(0);
142 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- creates an object URL for the local file and revokes it on cleanup
143 useEffect(() => {
144 if (!props.file) return;
145 const url = URL.createObjectURL(props.file);
@@ -146,6 +147,7 @@ export function AttachmentFilePreview(props: {
147 setLocalUrl(url);
148 return () => URL.revokeObjectURL(url);
149 }, [props.file]);
150 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- authorizes a remote attachment URL from the server and ignores the result after cleanup
151 useEffect(() => {
152 if (props.file) return;
153 let cancelled = false;
@@ -175,6 +177,7 @@ export function AttachmentFilePreview(props: {
177 (props.sizeBytes === 0 && (!resource || resource._tag === "attachment")));
178 const needsText =
179 kind === "text" || kind === "markdown" || kind === "mermaid" || (kind === "html" && !rendered);
180 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- fetches the file's text from its URL or Blob stream and aborts the request on cleanup
181 useEffect(() => {
182 if (!needsText || streamsText || !url) return;
183 const controller = new AbortController();
apps/web/src/components/files/BinaryViewer.tsx
+2 -2
@@ -46,7 +46,7 @@ function ArchiveFile(props: { readonly path: string; readonly bytes: Uint8Array<
46 return null;
47 }
48 })();
49 - // oxlint-disable-next-line t3code/react-effect-budget -- Create an object URL for the extracted image and revoke it when the entry changes or unmounts.
49 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Create an object URL for the extracted image and revoke it when the entry changes or unmounts.
50 useEffect(() => {
51 if (kind !== "image") return;
52 const extension = props.path.slice(props.path.lastIndexOf("."));
@@ -108,7 +108,7 @@ export default function BinaryViewer(props: {
108 }, 15_000);
109 workerRef.current?.postMessage(request);
110 };
111 - // oxlint-disable-next-line t3code/react-effect-budget -- Own the binary fetch, archive or database worker, message subscription, and request timeout for this file.
111 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Own the binary fetch, archive or database worker, message subscription, and request timeout for this file.
112 useEffect(() => {
113 const controller = new AbortController();
114 const worker = new Worker(new URL("./binaryPreview.worker.ts", import.meta.url), {
apps/web/src/components/files/BrowserDocumentFrame.tsx
+4
@@ -156,6 +156,7 @@ export function HtmlRenderDocument(props: {
156 const postTheme = () => {
157 frameRef.current?.contentWindow?.postMessage(htmlRenderThemeMessage(theme), "*");
158 };
159 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- posts the current theme to the sandboxed iframe's window
160 useEffect(postTheme, [theme]);
161 const keybindings = useAtomValue(primaryServerKeybindingsAtom);
162 const environmentKeybindings = useAtomValue(
@@ -190,6 +191,7 @@ export function HtmlRenderDocument(props: {
191 "*",
192 );
193 };
194 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- posts allowed and blocked shortcuts to the sandboxed iframe's window
195 useEffect(postShortcuts, [blocked, shortcuts]);
196 // Pages can forge key/code pairs; reject pairs matching other bindings and require named keys to match the
197 // shortcut.
@@ -230,6 +232,7 @@ export function HtmlRenderDocument(props: {
232 void openLink(url, { event: modifiers }).catch((cause: unknown) => console.error(cause));
233 });
234 const { onFullscreenChange } = props;
235 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reports fullscreen to the parent while the image viewer is open, and clears it on unmount
236 useEffect(() => {
237 if (expandedImage === null) return;
238 onFullscreenChange?.(true);
@@ -266,6 +269,7 @@ export function HtmlRenderDocument(props: {
269 }
270 });
271 // Attach at commit because a fast page may post its initial height before passive effects run.
272 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- attaches a window message listener for the iframe at commit, before its first height post
273 useLayoutEffect(() => {
274 const frame = frameRef.current;
275 if (frame === null) return;
apps/web/src/components/files/DocumentPages.tsx
+2 -2
@@ -78,7 +78,7 @@ export default function DocumentPages(props: {
78 }) {
79 const { theme, resolvedTheme, themeHalves } = useTheme();
80 const [colors, setColors] = useState(documentColors);
81 - // oxlint-disable-next-line t3code/react-effect-budget -- Read the host DOM's applied theme tokens so the sandboxed document receives the current palette.
81 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Read the host DOM's applied theme tokens so the sandboxed document receives the current palette.
82 useEffect(() => {
83 // The iframe cannot inherit the host palette across its sandbox boundary.
84 // oxlint-disable-next-line react/set-state-in-effect -- Read tokens after useTheme applies the selected palette.
@@ -88,7 +88,7 @@ export default function DocumentPages(props: {
88 const [zoom, setZoom] = useState(1);
89 const [outputHeight, setOutputHeight] = useState(0);
90 const stopObserving = useRef<(() => void) | null>(null);
91 - // oxlint-disable-next-line t3code/react-effect-budget -- Disconnect the iframe body's resize observer when the document unmounts.
91 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Disconnect the iframe body's resize observer when the document unmounts.
92 useEffect(() => () => stopObserving.current?.(), []);
93 const html = sanitizeDocumentHtml(props.html);
94 const srcDoc = `<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'"><style>:root{color-scheme:${resolvedTheme}}html{background:${colors[0]};color:${colors[1]};font:${15 * zoom}px/1.65 system-ui,sans-serif}body{box-sizing:border-box;margin:${props.output ? "0" : "20px auto"};padding:${props.output ? "16px" : "32px"};width:${props.output ? "100%" : "calc(100% - 40px)"};max-width:${860 * zoom}px;min-height:${props.output ? "0" : "calc(100vh - 40px)"};display:flow-root;background:${colors[2]};overflow-wrap:anywhere}h1,h2,h3{line-height:1.25}img{max-width:100%;height:auto}table{border-collapse:collapse;min-width:100%;max-width:100%}td,th{border:1px solid ${colors[3]};padding:6px 12px;text-align:left}th{background:${colors[0]}}tr:nth-child(even){background:${colors[0]}}pre,span[data-odf-whitespace]{white-space:pre-wrap}*{scrollbar-width:thin}${props.output ? "" : "@media(max-width:420px){body{padding:20px;width:calc(100% - 24px);margin:12px auto}}"}</style></head><body>${html}</body></html>`;
apps/web/src/components/files/FileBrowserPanel.tsx
+7
@@ -294,6 +294,7 @@ export default function FileBrowserPanel({
294 onSearchChange: (value) => setQuery(value ?? ""),
295 unsafeCSS: PIERRE_TREE_UNSAFE_CSS,
296 });
297 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- makes the Pierre tree model re-render row decorations when loading directories change
298 useEffect(() => {
299 if (loadingDirectoriesRef.current === loadingDirectories) return;
300 loadingDirectoriesRef.current = loadingDirectories;
@@ -319,6 +320,7 @@ export default function FileBrowserPanel({
320 search.close();
321 };
322 const expandedPathsRef = useRef(new Set<string>());
323 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to the Pierre tree model to load directories as they are expanded
324 useEffect(() => {
325 const currentPaths = new Set(directoryPaths);
326 for (const path of expandedPathsRef.current) {
@@ -342,6 +344,7 @@ export default function FileBrowserPanel({
344 loadExpanded();
345 return model.subscribe(loadExpanded);
346 }, [directoryPaths, load, model]);
347 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes ignored-file status into the imperative Pierre tree model
348 useEffect(() => {
349 model.setGitStatus(
350 entries
@@ -352,6 +355,7 @@ export default function FileBrowserPanel({
355 })),
356 );
357 }, [entries, model]);
358 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- loads the selected file's ancestor directories and aborts on cleanup
359 useEffect(() => {
360 if (!selectedPath) return;
361 const controller = new AbortController();
@@ -382,6 +386,7 @@ export default function FileBrowserPanel({
386 resourceKey: `files:${environmentId}:${cwd}`,
387 });
388
389 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- applies tree path changes to the imperative Pierre tree model as a reset or batch update
390 useEffect(() => {
391 if (!ready) return;
392 if (previousTreePathsRef.current === treePaths) return;
@@ -396,11 +401,13 @@ export default function FileBrowserPanel({
401 if (updates.length > 0) model.batch(updates);
402 }, [ready, entryKinds, model, treePaths]);
403
404 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- expands every directory in the Pierre tree model while expand-all is on and no search is active
405 useEffect(() => {
406 if (expandAll && !query.trim())
407 setAllDirectoriesExpanded(model, expandableDirectoryPaths, true);
408 }, [expandableDirectoryPaths, expandAll, model, query]);
409
410 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reveals an externally selected path in the Pierre tree model by expanding, selecting and scrolling
411 useEffect(() => {
412 if (!selectedPath) {
413 handledRevealRef.current = null;
apps/web/src/components/files/FilePreviewPanel.tsx
+3
@@ -620,6 +620,7 @@ function useEditableAfterHighlight(file: FileContents) {
620 const needsHighlight = needsWorkerHighlight(workerPool, file);
621 const ready = !needsHighlight || highlightedFile === file;
622
623 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- primes the worker pool's highlight cache for this file and falls back to plain text if it fails
624 useEffect(() => {
625 if (ready || workerPool === undefined) return;
626 workerPool.primeFileHighlightCache(file).catch(() => setHighlightedFile(file));
@@ -812,6 +813,7 @@ function EditableFileSurface({
813 const hasOpenCommentForm = lineAnnotations.some((annotation) =>
814 annotation.metadata.entries.some((entry) => entry.kind === "draft"),
815 );
816 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- installs selection dismissal listeners on the editor surface DOM node
817 useEffect(() => {
818 const root = surfaceRef.current;
819 if (!root) return;
@@ -1163,6 +1165,7 @@ export default function FilePreviewPanel({
1165 : NO_FILE_REVISION_ATOM,
1166 );
1167
1168 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the breadcrumb DOM so the deepest and current crumbs are in view after commit
1169 useEffect(() => {
1170 const crumbs = breadcrumbRef.current?.querySelectorAll<HTMLElement>("[data-file-crumb]");
1171 // Show the deepest crumb when it fits, but never at the cost of the current one.
apps/web/src/components/files/FontViewer.tsx
+1 -1
@@ -42,7 +42,7 @@ export default function FontViewer(props: { readonly src: string; readonly name:
42 const { resolvedTheme } = useTheme();
43 const [data, setData] = useState<string | null>(null);
44 const [error, setError] = useState<string | null>(null);
45 - // oxlint-disable-next-line t3code/react-effect-budget -- Load the font from its URL and abort the request and timeout when the source changes or unmounts.
45 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Load the font from its URL and abort the request and timeout when the source changes or unmounts.
46 useEffect(() => {
47 const controller = new AbortController();
48 const timeout = setTimeout(() => {
apps/web/src/components/files/InlineAudioPreview.tsx
+1
@@ -23,6 +23,7 @@ export function InlineAudioPreview(props: {
23 const src = visible ? (asset._tag === "Success" ? asset.url : props.src) : undefined;
24 const failed = asset._tag === "Failure" || (src !== undefined && failedSrc === src);
25
26 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- IntersectionObserver defers loading the audio until the element scrolls into view
27 useEffect(() => {
28 const element = container.current;
29 if (!element) return;
apps/web/src/components/files/LargeTextViewer.tsx
+1 -1
@@ -47,7 +47,7 @@ export default function LargeTextViewer(props: {
47 } | null>(null);
48 const pending = useRef(new Set<number>());
49 const wordWrap = useClientSettings((settings) => settings.wordWrap);
50 - // oxlint-disable-next-line t3code/react-effect-budget -- Own the prefix fetch and indexing worker, cancelling requests and pending copies when the source changes or unmounts.
50 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Own the prefix fetch and indexing worker, cancelling requests and pending copies when the source changes or unmounts.
51 useEffect(() => {
52 // oxlint-disable-next-line react/set-state-in-effect -- A replacement source must discard the previous worker's error and pages.
53 setError(null);
apps/web/src/components/files/NotebookPreview.tsx
+1 -1
@@ -57,7 +57,7 @@ export default function NotebookPreview(props: {
57 (count, cell) => count + cell.outputs.filter((output) => output.kind === "html").length,
58 0,
59 );
60 - // oxlint-disable-next-line t3code/react-effect-budget -- Observe output visibility and measure departing outputs to bound iframe lifetimes while preserving scroll height.
60 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Observe output visibility and measure departing outputs to bound iframe lifetimes while preserving scroll height.
61 useEffect(() => {
62 const root = scroll.current;
63 if (!root || !outputCount) return;
apps/web/src/components/files/OfficeViewer.tsx
+1 -1
@@ -85,7 +85,7 @@ function ExtendedOfficeViewer(props: {
85 const [page, setPage] = useState(0);
86 const workerRef = useRef<Worker | null>(null);
87 const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
88 - // oxlint-disable-next-line t3code/react-effect-budget -- Own the Office fetch, preparation worker, and timeout for this source and release them on cleanup.
88 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Own the Office fetch, preparation worker, and timeout for this source and release them on cleanup.
89 useEffect(() => {
90 const controller = new AbortController();
91 if ((props.sizeBytes ?? 0) > OFFICE_PREVIEW_MAX_BYTES) {
apps/web/src/components/files/OpenXmlOfficeViewer.tsx
+1 -1
@@ -45,7 +45,7 @@ export default function OfficeViewer(props: {
45 const fail = useStableCallback((cause: unknown) =>
46 setError(cause instanceof Error ? cause.message : "Could not render this Office document."),
47 );
48 - // oxlint-disable-next-line t3code/react-effect-budget -- Own the Open XML fetch, preparation worker, and timeout for this source and release them on cleanup.
48 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Own the Open XML fetch, preparation worker, and timeout for this source and release them on cleanup.
49 useEffect(() => {
50 if ((props.sizeBytes ?? 0) > OFFICE_PREVIEW_MAX_BYTES) {
51 // Metadata bounds are checked before fetching or starting an engine.
apps/web/src/components/files/PdfViewer.tsx
+7 -7
@@ -42,7 +42,7 @@ function PdfPage(props: {
42 const canvas = useRef<HTMLCanvasElement>(null);
43 const text = useRef<HTMLDivElement>(null);
44 const { document: pdf, index, width, onSize, onError } = props;
45 - // oxlint-disable-next-line t3code/react-effect-budget -- Render the PDF page canvas and text layer, cancelling tasks and releasing pdf.js page resources on cleanup.
45 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Render the PDF page canvas and text layer, cancelling tasks and releasing pdf.js page resources on cleanup.
46 useEffect(() => {
47 let cancelled = false;
48 let paint: ReturnType<Awaited<ReturnType<PDFDocumentProxy["getPage"]>>["render"]> | undefined;
@@ -91,7 +91,7 @@ function PdfPage(props: {
91 void Promise.allSettled([paint?.promise]).then(() => loadedPage?.cleanup());
92 };
93 }, [pdf, index, width, onSize, onError]);
94 - // oxlint-disable-next-line t3code/react-effect-budget -- Highlight pdf.js-owned text nodes and observe asynchronous text layer mutations for the current search query.
94 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Highlight pdf.js-owned text nodes and observe asynchronous text layer mutations for the current search query.
95 useEffect(() => {
96 const node = text.current;
97 if (!node) return;
@@ -133,7 +133,7 @@ export default function PdfViewer(props: { src: string; title: string }) {
133 const scroll = useRef<HTMLDivElement>(null);
134 const find = useRef<HTMLInputElement>(null);
135 const zoomAnchor = useRef<{ page: number; offset: number; width: number } | null>(null);
136 - // oxlint-disable-next-line t3code/react-effect-budget -- Own the PDF fetch, load timeout, and pdf.js document task across source changes, retries, and unmounts.
136 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Own the PDF fetch, load timeout, and pdf.js document task across source changes, retries, and unmounts.
137 useEffect(() => {
138 const controller = new AbortController();
139 let disposed = false;
@@ -173,7 +173,7 @@ export default function PdfViewer(props: { src: string; title: string }) {
173 void task?.destroy();
174 };
175 }, [props.src, revision]);
176 - // oxlint-disable-next-line t3code/react-effect-budget -- Measure the PDF viewport before paint and observe resizes for fit-width sizing and visible-page selection.
176 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Measure the PDF viewport before paint and observe resizes for fit-width sizing and visible-page selection.
177 useLayoutEffect(() => {
178 const node = scroll.current;
179 if (!node) return;
@@ -206,7 +206,7 @@ export default function PdfViewer(props: { src: string; title: string }) {
206 };
207 setZoom(value);
208 };
209 - // oxlint-disable-next-line t3code/react-effect-budget -- Restore the DOM scroll anchor after the new zoom width has committed to page layout.
209 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Restore the DOM scroll anchor after the new zoom width has committed to page layout.
210 useLayoutEffect(() => {
211 const anchor = zoomAnchor.current;
212 zoomAnchor.current = null;
@@ -215,11 +215,11 @@ export default function PdfViewer(props: { src: string; title: string }) {
215 top: offsets[anchor.page]! - 16 + (anchor.offset * width) / anchor.width,
216 });
217 });
218 - // oxlint-disable-next-line t3code/react-effect-budget -- Scroll to the first asynchronous search result after its measured page offsets have committed.
218 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Scroll to the first asynchronous search result after its measured page offsets have committed.
219 useLayoutEffect(() => {
220 if (matches.length) jumpToPage(matches[0]!);
221 }, [matches]);
222 - // oxlint-disable-next-line t3code/react-effect-budget -- Debounce pdf.js text extraction and cancel obsolete searches when the query or document changes.
222 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Debounce pdf.js text extraction and cancel obsolete searches when the query or document changes.
223 useEffect(() => {
224 if (!pdf || !query.trim()) {
225 // oxlint-disable-next-line react/set-state-in-effect -- A blank query cancels the previous search.
apps/web/src/components/files/PreviewImageContent.tsx
+1 -1
@@ -17,7 +17,7 @@ export default function PreviewImageContent(props: {
17 const [viewport, setViewport] = useState({ width: 0, height: 0 });
18 const [zoom, setZoom] = useState<number | null>(null);
19 const ref = useRef<HTMLDivElement>(null);
20 - // oxlint-disable-next-line t3code/react-effect-budget -- Measure the image viewport before paint and observe resizes to keep fit-to-view scaling accurate.
20 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Measure the image viewport before paint and observe resizes to keep fit-to-view scaling accurate.
21 useLayoutEffect(() => {
22 const node = ref.current;
23 if (!node) return;
apps/web/src/components/files/VirtualTablePreview.tsx
+9 -9
@@ -23,7 +23,7 @@ export default function VirtualTablePreview(props: {
23 const widthRef = useRef(0);
24 const measureRef = useRef<HTMLTableElement>(null);
25 const [measured, setMeasured] = useState<number[] | null>(null);
26 - // oxlint-disable-next-line t3code/react-effect-budget -- Measure the viewport before paint and observe container resizes to invalidate column measurements.
26 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Measure the viewport before paint and observe container resizes to invalidate column measurements.
27 useLayoutEffect(() => {
28 const node = ref.current;
29 if (!node) return;
@@ -39,7 +39,7 @@ export default function VirtualTablePreview(props: {
39 update();
40 return observeResize(node, update);
41 }, []);
42 - // oxlint-disable-next-line t3code/react-effect-budget -- Read the browser's laid-out table column widths before displaying the virtual table.
42 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Read the browser's laid-out table column widths before displaying the virtual table.
43 useLayoutEffect(() => {
44 if (!width || !props.header || !measureRef.current || measured) return;
45 const widths = [...measureRef.current.querySelectorAll("thead th")].map(
@@ -184,7 +184,7 @@ function RowPage(
184 const rows = props.getRows(props.page);
185 // A page stays mounted while the worker fills it, preserving the scroll position.
186 const { loadPage, page } = props;
187 - // oxlint-disable-next-line t3code/react-effect-budget -- Request missing rows from the indexing worker while preserving the mounted page's scroll position.
187 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Request this page's rows from the indexing worker when they are missing or incomplete.
188 useEffect(() => {
189 const expected = Math.min(PREVIEW_PAGE_ROWS, props.count - page * PREVIEW_PAGE_ROWS);
190 if (!rows || rows.length < expected) loadPage?.(page);
@@ -274,7 +274,7 @@ function ScaledRows(props: Omit<Parameters<typeof RowPage>[0], "page">) {
274 // The final mounted rows keep their measured height and scroll natively.
275 const nativeTail = first - headerRows === maxFirst;
276 const scrollModel = useRef({ scale, maxFirst, heights: [] as number[] });
277 - // oxlint-disable-next-line t3code/react-effect-budget -- Measure native tail rows and preserve the DOM scroll position when the virtual track scale changes.
277 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Measure native tail rows and preserve the DOM scroll position when the virtual track scale changes.
278 useLayoutEffect(() => {
279 const previous = scrollModel.current;
280 const heights = nativeTail
@@ -304,7 +304,7 @@ function ScaledRows(props: Omit<Parameters<typeof RowPage>[0], "page">) {
304 node.scrollTop = Math.min(maxFirst * 29, logicalTop) * scale + nativeOffset;
305 setTop(node.scrollTop);
306 });
307 - // oxlint-disable-next-line t3code/react-effect-budget -- Scroll the DOM viewport to a requested line after its virtual track has committed.
307 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Scroll the DOM viewport to a requested line after its virtual track has committed.
308 useLayoutEffect(() => {
309 const node = ref.current;
310 if (props.revealLine == null) {
@@ -335,7 +335,7 @@ function ScaledRows(props: Omit<Parameters<typeof RowPage>[0], "page">) {
335 pendingEnd.current = false;
336 node.scrollTop += delta * (nativeTail ? 1 : (scale * 29) / rowHeight());
337 });
338 - // oxlint-disable-next-line t3code/react-effect-budget -- Install a non-passive native wheel listener so virtual scrolling can prevent the browser's default scroll.
338 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Install a non-passive native wheel listener so virtual scrolling can prevent the browser's default scroll.
339 useEffect(() => {
340 const node = ref.current;
341 if (!node) return;
@@ -347,7 +347,7 @@ function ScaledRows(props: Omit<Parameters<typeof RowPage>[0], "page">) {
347 }, []);
348 const page = Math.floor(first / PREVIEW_PAGE_ROWS);
349 const visibleEnd = (first % PREVIEW_PAGE_ROWS) + Math.ceil(position.height / 29) + 1;
350 - // oxlint-disable-next-line t3code/react-effect-budget -- Measure mounted row offsets and observe content resizes to position the virtual rows against the scroll track.
350 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Measure mounted row offsets and observe content resizes to position the virtual rows against the scroll track.
351 useLayoutEffect(() => {
352 if (atStart) return;
353 const node = contentRef.current;
@@ -366,7 +366,7 @@ function ScaledRows(props: Omit<Parameters<typeof RowPage>[0], "page">) {
366 update();
367 return observeResize(node, update);
368 }, [first, atStart]);
369 - // oxlint-disable-next-line t3code/react-effect-budget -- Correct the DOM scroll position once a requested worker row has loaded and its actual bounds are measurable.
369 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Correct the DOM scroll position once a requested worker row has loaded and its actual bounds are measurable.
370 useLayoutEffect(() => {
371 const pending = pendingReveal.current;
372 const node = ref.current;
@@ -406,7 +406,7 @@ function ScaledRows(props: Omit<Parameters<typeof RowPage>[0], "page">) {
406 node.scrollTop += delta * (nativeTail ? 1 : (scale * 29) / Math.max(29, bounds.height));
407 setTop(node.scrollTop);
408 });
409 - // oxlint-disable-next-line t3code/react-effect-budget -- Complete End-key scrolling after the final worker row has loaded and its DOM layout has settled.
409 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Complete End-key scrolling after the final worker row has loaded and its DOM layout has settled.
410 useLayoutEffect(() => {
411 const node = ref.current;
412 const content = contentRef.current;
apps/web/src/components/files/fileSaveSessions.ts
+1 -1
@@ -166,7 +166,7 @@ export function useFileSaveSession(
166 { environmentId, cwd, relativePath }: FileSaveTarget,
167 onPendingChange: FilePendingListener,
168 ): void {
169 - // oxlint-disable-next-line t3code/react-effect-budget -- the lease is a mount-scoped external resource; React runs every unmount cleanup before mount setups, so a surface switch flushes before the next surface recovers.
169 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- the lease is a mount-scoped external resource; React runs every unmount cleanup before mount setups, so a surface switch flushes before the next surface recovers.
170 useEffect(
171 () => fileSaveSessions.acquire({ environmentId, cwd, relativePath }, onPendingChange),
172 [environmentId, cwd, relativePath, onPendingChange],
apps/web/src/components/files/office/OfficePages.tsx
+6 -6
@@ -36,7 +36,7 @@ export function OfficePages(props: {
36 const [width, setWidth] = useState(0);
37 const [settledWidth, setSettledWidth] = useState(0);
38 const [mounted, setMounted] = useState(6);
39 - // oxlint-disable-next-line t3code/react-effect-budget -- Observe the scroll container width and debounce raster resizing, releasing the observer and timer on unmount.
39 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Observe the scroll container width and debounce raster resizing, releasing the observer and timer on unmount.
40 useEffect(() => {
41 const root = scroller.current;
42 if (!root) return;
@@ -53,7 +53,7 @@ export function OfficePages(props: {
53 unobserve();
54 };
55 }, []);
56 - // oxlint-disable-next-line t3code/react-effect-budget -- Yield between page mounting batches with a timer so large documents do not block the browser.
56 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Yield between page mounting batches with a timer so large documents do not block the browser.
57 useEffect(() => {
58 if (mounted >= props.pages.length) return;
59 const timer = setTimeout(() => setMounted((n) => Math.min(props.pages.length, n + 50)), 0);
@@ -146,7 +146,7 @@ function OfficePage(props: {
146 const canvas = useRef<HTMLCanvasElement>(null);
147 const [near, setNear] = useState(false);
148 const [ratio, setRatio] = useState(window.devicePixelRatio || 1);
149 - // oxlint-disable-next-line t3code/react-effect-budget -- Observe the page's viewport proximity to limit painting and text layers to nearby pages.
149 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Observe the page's viewport proximity to limit painting and text layers to nearby pages.
150 useEffect(() => {
151 if (!row.current) return;
152 const observer = new IntersectionObserver(
@@ -156,14 +156,14 @@ function OfficePage(props: {
156 observer.observe(row.current);
157 return () => observer.disconnect();
158 }, [root]);
159 - // oxlint-disable-next-line t3code/react-effect-budget -- Subscribe to display density changes so canvas rasters match the current screen.
159 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Subscribe to display density changes so canvas rasters match the current screen.
160 useEffect(() => {
161 const query = matchMedia(`(resolution: ${ratio}dppx)`);
162 const change = () => setRatio(window.devicePixelRatio || 1);
163 query.addEventListener("change", change);
164 return () => query.removeEventListener("change", change);
165 }, [ratio]);
166 - // oxlint-disable-next-line t3code/react-effect-budget -- Paint the visible page canvas at the current raster scale and cancel obsolete paint requests.
166 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Paint the visible page canvas at the current raster scale and cancel obsolete paint requests.
167 useEffect(() => {
168 const target = canvas.current;
169 if (!target || !page || !near || ratio <= 0 || rasterScale <= 0) return;
@@ -173,7 +173,7 @@ function OfficePage(props: {
173 });
174 return () => controller.abort();
175 }, [near, index, page, paint, rasterScale, onError, ratio]);
176 - // oxlint-disable-next-line t3code/react-effect-budget -- Release the canvas backing store when its page moves away from the viewport.
176 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Release the canvas backing store when its page moves away from the viewport.
177 useEffect(() => {
178 const target = canvas.current;
179 if (!near && target) {
apps/web/src/components/files/office/Presentation.tsx
+1 -1
@@ -26,7 +26,7 @@ export default function Presentation(props: {
26 const [page, setPage] = useState(0);
27 const [failed, setFailed] = useState<Record<number, boolean>>({});
28 const scroll = useRef<((index: number, y?: number) => void) | null>(null);
29 - // oxlint-disable-next-line t3code/react-effect-budget -- Open and paint slides through a worker whose requests and lifetime belong to this presentation.
29 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Open and paint slides through a worker whose requests and lifetime belong to this presentation.
30 useEffect(() => {
31 const controller = new AbortController();
32 const worker = new Worker(new URL("./presentation.worker.ts", import.meta.url), {
apps/web/src/components/files/office/Spreadsheet.tsx
+3 -3
@@ -49,7 +49,7 @@ export default function Spreadsheet(props: {
49 const [opened, setOpened] = useState<Opened>();
50 const [error, setError] = useState("");
51 const picking = useRef<AbortController | null>(null);
52 - // oxlint-disable-next-line t3code/react-effect-budget -- Open the workbook worker and cancel workbook and sheet requests when the source changes or unmounts.
52 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Open the workbook worker and cancel workbook and sheet requests when the source changes or unmounts.
53 useEffect(() => {
54 const controller = new AbortController();
55 const worker = new Worker(new URL("./spreadsheet.worker.ts", import.meta.url), {
@@ -163,11 +163,11 @@ function SpreadsheetGrid(props: {
163 const [reader, setReader] = useState<{ row: number; col: number; text: string }[]>([]);
164 const [active, setActive] = useState({ row: 0, col: 0 });
165 const navigate = useRef(onNavigate);
166 - // oxlint-disable-next-line t3code/react-effect-budget -- Keep the installed native pointer listener calling the latest navigation handler without restarting the canvas engine.
166 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Keep the installed native pointer listener calling the latest navigation handler without restarting the canvas engine.
167 useEffect(() => {
168 navigate.current = onNavigate;
169 }, [onNavigate]);
170 - // oxlint-disable-next-line t3code/react-effect-budget -- Own canvas painting, worker requests, resize observation, and native scroll, keyboard, and pointer listeners for this sheet.
170 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Own canvas painting, worker requests, resize observation, and native scroll, keyboard, and pointer listeners for this sheet.
171 useEffect(() => {
172 const root = scroller.current;
173 const target = canvas.current;
apps/web/src/components/files/office/WordDocument.tsx
+2 -2
@@ -28,7 +28,7 @@ export default function WordDocument(props: {
28 const { onError, bytes, onDetails } = props;
29 const [opened, setOpened] = useState<Opened>();
30 const scroll = useRef<((index: number, y?: number) => void) | null>(null);
31 - // oxlint-disable-next-line t3code/react-effect-budget -- Own the document worker and cancel its layout and painting requests when the document changes or unmounts.
31 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Own the document worker and cancel its layout and painting requests when the document changes or unmounts.
32 useEffect(() => {
33 const controller = new AbortController();
34 const worker = new Worker(new URL("./document.worker.ts", import.meta.url), { type: "module" });
@@ -121,7 +121,7 @@ function WordTextLayer(props: {
121 }) {
122 const { engine, index, page, follow } = props;
123 const [spans, setSpans] = useState<readonly WordSpan[]>([]);
124 - // oxlint-disable-next-line t3code/react-effect-budget -- Request selectable text from the document worker and cancel the request when its page leaves the viewport.
124 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Request selectable text from the document worker and cancel the request when its page leaves the viewport.
125 useEffect(() => {
126 if (!page) return;
127 const controller = new AbortController();
apps/web/src/components/files/useDirectoryEntries.ts
+1
@@ -94,6 +94,7 @@ export function useDirectoryEntries(environmentId: EnvironmentId, cwd: string) {
94 return startRequest(directoryPath, refresh);
95 };
96
97 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- starts the root directory read on mount and marks the hook inactive so late reads are ignored
98 useEffect(() => {
99 active.current = true;
100 if (!requests.current.has("") && !loaded.current.has("")) void startRequest("", false);
apps/web/src/components/guest/GuestHtmlRender.tsx
+3
@@ -38,6 +38,7 @@ export function GuestHtmlRender({
38 () =>
39 `${GUEST_RENDER_ROUTE}?${GUEST_SHARE_PARAM}=${encodeURIComponent(shareId)}&item=${encodeURIComponent(itemId)}${htmlRenderThemeFragment(theme)}`,
40 );
41 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the frame box and follows its width with a ResizeObserver before paint
42 useLayoutEffect(() => {
43 const box = boxRef.current;
44 if (!box) return;
@@ -46,9 +47,11 @@ export function GuestHtmlRender({
47 if (entry) setWidth(entry.contentRect.width);
48 });
49 }, []);
50 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- posts theme changes to the iframe's window
51 useEffect(() => {
52 frameRef.current?.contentWindow?.postMessage(htmlRenderThemeMessage(theme), "*");
53 }, [theme]);
54 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window message listener for the iframe's height reports and link requests
55 useEffect(() => {
56 const onMessage = (event: MessageEvent) => {
57 const frame = frameRef.current;
apps/web/src/components/guest/GuestPage.tsx
+7
@@ -175,6 +175,7 @@ export function GuestPage() {
175 // A browser that already joined this share goes straight back in, even from the spent link.
176 // Sessions are per share, so one for another link never stands in for this one.
177 const [access, setAccess] = useState<GuestAccess>(shareId === null ? "none" : "checking");
178 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- fetches whether this browser already has a guest session and ignores the answer after cleanup
179 useEffect(() => {
180 if (shareId === null) return;
181 let live = true;
@@ -195,6 +196,7 @@ export function GuestPage() {
196 }, [credential, shareId]);
197 // Pasting another guest link into this tab changes only the hash, which does not reload the
198 // page; reload so the new invite is read instead of the one already captured.
199 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- hashchange listener reloads the page when another guest link is pasted into this tab
200 useEffect(() => {
201 const onHashChange = () => {
202 if (window.location.hash !== "") window.location.reload();
@@ -233,15 +235,18 @@ function GuestSession({ shareId }: { readonly shareId: string }) {
235 ...initialGuestStreamState,
236 awaitingRowIds: readAwaitingRowIds(),
237 }));
238 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- persists the awaiting row ids to sessionStorage so a reload keeps them
239 useEffect(() => writeAwaitingRowIds(stream.awaitingRowIds), [stream.awaitingRowIds]);
240 // EventSource closes for good only on a non-200 response, which the guest routes send for a
241 // missing, invalid, or ended session. Network drops reconnect on their own.
242 const [rejected, setRejected] = useState(false);
243
244 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- sets document.title to the shared thread's title
245 useEffect(() => {
246 if (stream.view) document.title = stream.view.title;
247 }, [stream.view]);
248
249 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens the guest EventSource stream and closes it on cleanup
250 useEffect(() => {
251 const source = new EventSource(
252 `${GUEST_ROUTE_PREFIX}/stream?${GUEST_SHARE_PARAM}=${encodeURIComponent(shareId)}`,
@@ -419,6 +424,7 @@ function GuestThread({
424 const previousUnplacedKey = useRef(unplacedKey);
425 const following = useRef(follow.timelineLiveFollowEnabled);
426 const scrollToEnd = useStableCallback(follow.scrollToEnd);
427 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the timeline to the end after commit when new unplaced messages appear
428 useEffect(() => {
429 following.current = follow.timelineLiveFollowEnabled;
430 const previous = new Set(previousUnplacedKey.current.split(","));
@@ -427,6 +433,7 @@ function GuestThread({
433 }, [follow.timelineLiveFollowEnabled, unplacedKey, scrollToEnd, following, previousUnplacedKey]);
434 const footerRef = useRef<HTMLOListElement>(null);
435 const hasFooter = unplaced.length > 0;
436 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- ResizeObserver on the footer keeps it scrolled into view while following
437 useEffect(() => {
438 const footer = footerRef.current;
439 if (!hasFooter || footer === null) return;
apps/web/src/components/media/AttachmentImage.tsx
+1 -1
@@ -48,7 +48,7 @@ function DecodedImage({ name, mimeType, src, onError, ...props }: AttachmentImag
48 });
49 };
50
51 - // oxlint-disable-next-line t3code/react-effect-budget -- the async decode and its blob URL live as long as this component
51 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- the async decode and its blob URL live as long as this component
52 useEffect(
53 () => () => {
54 const attempt = decodeRef.current;
apps/web/src/components/onboarding/FirstRunGate.tsx
+3
@@ -140,6 +140,7 @@ export function FirstRunGate({
140 if (transitioned !== gateState) setGateState(transitioned);
141 }
142
143 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- persists onboarding completion to settings once the gate settles on skipping the wizard
144 useEffect(() => {
145 if (decision === "wizard" || !hydrated) return;
146 if (persistCompletion && onboardingCompletedAt === null) {
@@ -147,6 +148,7 @@ export function FirstRunGate({
148 }
149 }, [decision, hydrated, onboardingCompletedAt, persistCompletion]);
150
151 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- timer gives up on a pending first-run decision after the timeout
152 useEffect(() => {
153 if (!enabled || decision !== "pending" || !hydrated) return;
154 const timer = window.setTimeout(
@@ -159,6 +161,7 @@ export function FirstRunGate({
161 // Setup opens by itself only from the home route. A direct link, such as
162 // Settings, opens as asked so setup can never lock a user out of the app.
163 const wizardOwnsRoute = pathname === "/";
164 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- navigates from the home route to /welcome when the gate decides on the wizard
165 useEffect(() => {
166 if (decision === "wizard" && wizardOwnsRoute) {
167 void navigate({ to: "/welcome", replace: true });
apps/web/src/components/onboarding/WelcomeWizard.tsx
+6
@@ -128,6 +128,7 @@ export function WelcomeWizard({
128 const finishingPromiseRef = useRef<Promise<boolean> | null>(null);
129 const completionErrorToastIdRef = useRef<ReturnType<typeof toastManager.add> | null>(null);
130 const primaryEnvironment = usePrimaryEnvironment();
131 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- marks newly listed computers in the shared auto-select registry once and selects the enabled ones
132 useEffect(() => {
133 const newComputers = environments.filter(
134 (environment) => !autoSelectedComputers.has(environment.environmentId),
@@ -319,6 +320,7 @@ function ConnectionStep({
320 .filter((environment) => skippedIds.includes(environment.environmentId))
321 .map((environment) => environment.label);
322 const continueRef = useRef<HTMLButtonElement>(null);
323 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- moves DOM focus to the Continue button once setup is ready and nothing else holds focus
324 useEffect(() => {
325 if (
326 ready &&
@@ -552,6 +554,7 @@ function PairingForm({
554 const [errorMessage, setErrorMessage] = useState("");
555 const mountedRef = useRef(true);
556
557 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- tracks mount so a pairing request that settles after unmount does not set state
558 useEffect(() => {
559 mountedRef.current = true;
560 return () => {
@@ -718,6 +721,7 @@ function ConnectedAgentsStep({
721 } | null>(null);
722 const canOperateTerminal = useEnvironmentScope(environmentId, AuthTerminalOperateScope);
723
724 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- asks the environment to refresh its provider list when the environment changes
725 useEffect(() => {
726 void refreshProviders({ environmentId, input: {} });
727 }, [environmentId, refreshProviders]);
@@ -1035,6 +1039,7 @@ function AgentInstallTerminal({
1039
1040 // StrictMode can finish a cancelled open after replacement setup; it must not close or pre-type into that
1041 // session.
1042 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens the setup PTY, types the command into it, and closes it on cleanup
1043 useEffect(() => {
1044 const generation = setupGenerationRef.current + 1;
1045 setupGenerationRef.current = generation;
@@ -1197,6 +1202,7 @@ function ImportStep({
1202 );
1203 const importGenerationRef = useRef(0);
1204
1205 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- bumps the import generation on mount and unmount so in-flight imports drop stale results
1206 useEffect(() => {
1207 importGenerationRef.current += 1;
1208 return () => {
apps/web/src/components/preview/AgentBrowserCursor.tsx
+1
@@ -66,6 +66,7 @@ export function AgentCursorMark(props: {
66 const [inactiveSequence, setInactiveSequence] = useState<number | null>(null);
67 const active = inactiveSequence !== sequence;
68
69 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- timer fades the agent cursor after each move or click
70 useEffect(() => {
71 const timeout = window.setTimeout(() => setInactiveSequence(sequence), CURSOR_ACTIVE_MS);
72 return () => window.clearTimeout(timeout);
apps/web/src/components/preview/PreviewPanelShell.tsx
+2
@@ -79,6 +79,7 @@ function PreviewPanelShellFrame(
79 stopObservingRow();
80 };
81 };
82 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- on unmount, returns DOM focus to the panel toggle if removal dropped it on the body
83 useLayoutEffect(() => {
84 const host = hostRef.current;
85 if (!host || !collapsible) return;
@@ -92,6 +93,7 @@ function PreviewPanelShellFrame(
93 });
94 };
95 }, [collapsible, hostRef]);
96 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- moves focus to the toggle and sets inert on the host DOM node before a collapse paints
97 useLayoutEffect(() => {
98 const host = hostRef.current;
99 if (!host) return;
apps/web/src/components/preview/PreviewView.tsx
+4
@@ -192,6 +192,7 @@ export function PreviewView({
192 const serverToolbarShown =
193 snapshot?.runtime === "server" && (snapshot.viewport ?? FILL_PREVIEW_VIEWPORT)._tag !== "fill";
194 const serverBodyRef = useRef<HTMLDivElement | null>(null);
195 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- ResizeObserver on the server preview body sizes the viewport toolbar
196 useEffect(() => {
197 const element = serverBodyRef.current;
198 if (!element || !serverToolbarShown) return;
@@ -790,6 +791,7 @@ export function PreviewView({
791 }).then(finishPick);
792 };
793
794 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- tells the preview bridge whether an element pick may send annotations
795 useEffect(() => {
796 if (!pickActive || !previewBridge || !runtimeTabId) return;
797 void previewBridge
@@ -797,6 +799,7 @@ export function PreviewView({
799 .catch(() => undefined);
800 }, [canSendAnnotation, pickActive, runtimeTabId]);
801
802 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels an in-progress element pick on the preview bridge when the tab changes or on unmount
803 useEffect(() => {
804 return () => {
805 if (!pickActiveRef.current) return;
@@ -833,6 +836,7 @@ export function PreviewView({
836 }
837 },
838 );
839 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to preview actions while the view is visible
840 useEffect(() => {
841 if (!visible) return;
842 return subscribePreviewAction((action) => onPreviewAction(action));
apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx
+1
@@ -440,6 +440,7 @@ function MiniPlayerShell({
440 const [pillOpen, setPillOpen] = useState(false);
441 const handleTappedRef = useRef(false);
442 const handleRef = useRef<HTMLDivElement | null>(null);
443 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- document pointerdown listener closes the open pill on an outside press
444 useEffect(() => {
445 if (!pillOpen) return;
446 const dismiss = (event: PointerEvent) => {
apps/web/src/components/preview/ZoomIndicator.tsx
+1
@@ -14,6 +14,7 @@ export function ZoomIndicator({ zoomFactor }: Props) {
14 const lastFactorRef = useRef(zoomFactor);
15 const timerRef = useRef<number | null>(null);
16
17 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- shows the indicator on a zoom change and hides it with a timer
18 useEffect(() => {
19 if (Math.abs(lastFactorRef.current - zoomFactor) < ZOOM_EPSILON) return;
20 lastFactorRef.current = zoomFactor;
apps/web/src/components/preview/usePreviewBridge.ts
+1
@@ -84,6 +84,7 @@ export function usePreviewBridge(input: {
84 });
85 },
86 );
87 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to preview bridge state changes and capture activity for the current tab
88 useEffect(() => {
89 if (!previewBridge || typeof window === "undefined") return;
90 lastReportedUrl.current = null;
apps/web/src/components/projectScriptEditor.tsx
+1
@@ -282,6 +282,7 @@ function ProjectScriptEditorForm({
282 const pendingSubmissionRef = useRef<object | null>(null);
283 // A save that settles after this form is replaced must not close or error
284 // the request that replaced it.
285 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- drops the pending save on unmount so a late result cannot close or fail the next request
286 useEffect(
287 () => () => {
288 pendingSubmissionRef.current = null;
apps/web/src/components/promptLinks/HostedPromptLinkLanding.tsx
+1
@@ -104,6 +104,7 @@ function HostedPromptLinkLanding({
104 const onPhone = /android|iphone|ipad/i.test(navigator.userAgent);
105 const autoOpenedRef = useRef(false);
106
107 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- redirects window.location to the app deep link once when the user chose to always open in the app
108 useEffect(() => {
109 if (!openInAppRemembered || !summary.ok || autoOpenedRef.current) return;
110 autoOpenedRef.current = true;
apps/web/src/components/promptLinks/NewThreadLinkView.tsx
+2
@@ -325,6 +325,7 @@ export function NewThreadLinkView({ link }: { readonly link: NewThreadLink }) {
325 }
326 });
327
328 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- runs each launch decision once: navigates to the thread or opens a draft
329 useEffect(() => {
330 if (launch === null || launchedRef.current === launch) return;
331 launchedRef.current = launch;
@@ -394,6 +395,7 @@ function PullRequestLinkCheckout({
395 },
396 });
397 const warnedRef = useRef(false);
398 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- shows the hidden-characters warning toast once per linked prompt
399 useEffect(() => {
400 if (warnedRef.current || link.prompt === null) return;
401 warnedRef.current = true;
apps/web/src/components/promptLinks/ThreadLinkPrompt.tsx
+1
@@ -20,6 +20,7 @@ export function ThreadLinkPrompt({ threadRef }: { readonly threadRef: ScopedThre
20 structuralSharing: true,
21 });
22
23 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- places a ?prompt link into the composer once per location and strips it from the URL via the router
24 useEffect(() => {
25 // A pending navigation shows the next location while the params still name this thread.
26 if (!isThreadRoutePathname(location.pathname, threadRef)) return;
apps/web/src/components/pullRequest/PullRequestCodeTab.tsx
+3
@@ -435,6 +435,7 @@ function PullRequestCodeTab({
435 isStale: isFileViewedStale,
436 } = filesViewed;
437 const appliedRefreshToken = useRef(refreshToken);
438 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- a new refresh token clears loaded slices and refetches the first diff page and viewed files
439 useEffect(() => {
440 if (appliedRefreshToken.current === refreshToken) return;
441 appliedRefreshToken.current = refreshToken;
@@ -446,6 +447,7 @@ function PullRequestCodeTab({
447 refreshFilesViewed();
448 }, [refreshToken, scopeKey, refreshFirstDiffPage, refreshFilesViewed]);
449 const appliedBackgroundRefreshToken = useRef(backgroundRefreshToken);
450 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- a background refresh token refetches the first diff page and viewed files while keeping slices
451 useEffect(() => {
452 if (appliedBackgroundRefreshToken.current === backgroundRefreshToken) return;
453 appliedBackgroundRefreshToken.current = backgroundRefreshToken;
@@ -1296,6 +1298,7 @@ function PullRequestCodeTab({
1298 answeredRevealNonce.current = revealRequest.nonce;
1299 revealFile(revealRequest.path);
1300 });
1301 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the code view to a requested file once loaded, or pages forward until it arrives
1302 useEffect(() => {
1303 // oxlint-disable-next-line react/set-state-in-effect -- A reveal for a file not loaded yet pages forward, which sets the slice cursor.
1304 answerReveal();
apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
+4
@@ -433,6 +433,7 @@ export function PullRequestDetailPanel({
433 scroller: HTMLDivElement;
434 target: number;
435 } | null>(null);
436 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- restores the scroller's scrollTop before paint after the header condenses
437 useLayoutEffect(() => {
438 const compensation = compensationRef.current;
439 if (compensation === null) return;
@@ -486,6 +487,7 @@ export function PullRequestDetailPanel({
487 event.stopPropagation();
488 if (!event.repeat) copyReference(`#${reference.number}`, `${terminology.shortLabel} number`);
489 });
490 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window keydown capture listener for the copy-number shortcut
491 useEffect(() => {
492 const onKeyDown = (event: KeyboardEvent) => copyFromShortcut(event);
493 window.addEventListener("keydown", onKeyDown, true);
@@ -576,6 +578,7 @@ export function PullRequestDetailPanel({
578 }
579 }
580 const revalidateActivity = useEffectEvent(() => activityQuery.refresh());
581 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- refreshes the activity query after commit when render counts a new detail revision
582 useEffect(() => {
583 if (activityRevalidations > 0) revalidateActivity();
584 }, [activityRevalidations]);
@@ -598,6 +601,7 @@ export function PullRequestDetailPanel({
601 };
602 const refreshFromHostOnRequest = useEffectEvent(() => void refreshFromHost());
603 const appliedForcedToken = useRef(forcedRefreshToken);
604 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- a new forced refresh token invalidates the host cache and refetches
605 useEffect(() => {
606 if (appliedForcedToken.current === forcedRefreshToken) return;
607 appliedForcedToken.current = forcedRefreshToken;
apps/web/src/components/pullRequest/PullRequestGuideTab.tsx
+1
@@ -78,6 +78,7 @@ export function PullRequestGuideTab({
78 const guide = data?.guide ?? null;
79 const tourShown = active && guide !== null;
80 const reportTourShown = useEffectEvent(() => onTourShown?.());
81 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- tells the parent once the loaded guide tour is on screen, which data arrival can cause
82 useEffect(() => {
83 if (tourShown) reportTourShown();
84 }, [tourShown]);
apps/web/src/components/pullRequest/PullRequestsColumn.tsx
+4
@@ -35,6 +35,7 @@ function ExpandableSearch({
35 onFocusWithin?: (focused: boolean) => void;
36 }) {
37 const containerRef = useRef<HTMLDivElement | null>(null);
38 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- focuses the search input DOM node when the topbar search opens
39 useEffect(() => {
40 if (!open) return;
41 containerRef.current?.querySelector("input")?.focus();
@@ -109,6 +110,7 @@ export function PullRequestsColumn({
110 }) {
111 const markerRef = useRef<HTMLDivElement | null>(null);
112 const [condensed, setCondensed] = useState(false);
113 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- IntersectionObserver on the scroll marker condenses the topbar
114 useEffect(() => {
115 const marker = markerRef.current;
116 if (!marker) return;
@@ -126,6 +128,7 @@ export function PullRequestsColumn({
128 const [searchOpen, setSearchOpen] = useState(false);
129 const topbarSearchRef = useRef<HTMLDivElement | null>(null);
130 const searchExpanded = searchOpen || searchValue.length > 0;
131 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window keydown listener focuses the visible search input on Cmd/Ctrl+F
132 useEffect(() => {
133 const onKeyDown = (event: KeyboardEvent) => {
134 if (event.defaultPrevented) return;
@@ -142,6 +145,7 @@ export function PullRequestsColumn({
145 return () => window.removeEventListener("keydown", onKeyDown);
146 }, [condensed]);
147 if (!condensed && searchOpen) setSearchOpen(false);
148 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- moves DOM focus to the in-flow search when the topbar search it was typed in unmounts
149 useEffect(() => {
150 if (condensed) return;
151 if (!topbarSearchFocusedRef.current) return;
apps/web/src/components/pullRequest/PullRequestsPage.tsx
+6
@@ -765,6 +765,7 @@ export function PullRequestsPage() {
765 statsByRow,
766 pending: statsQuery.isPending,
767 }));
768 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- queues eager stats batches for the rows, reading known stats and visible keys held outside render
769 useEffect(() => {
770 if (statsPolicy !== "eager") return;
771 const { statsByRow: known } = readStatsProgress();
@@ -784,6 +785,7 @@ export function PullRequestsPage() {
785 }, [filterKey, entriesByStatsKey, statsPolicy]);
786 // The observer outlives the rows it watches, so it reads the rows held at the time it fires.
787 const readStatsRows = useEffectEvent(() => entriesByStatsKey);
788 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- IntersectionObserver on rows requests stats for rows that scroll into view
789 useEffect(() => {
790 if (statsPolicy !== "visible" || typeof IntersectionObserver === "undefined") return;
791 visibleStatsKeys.current = { key: filterKey, values: new Set() };
@@ -833,6 +835,7 @@ export function PullRequestsPage() {
835 if (statsObserver.current === observer) statsObserver.current = null;
836 };
837 }, [filterKey, statsPolicy]);
838 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- prunes stats batches to the observer's visible rows once a stats request settles
839 useEffect(() => {
840 if (statsPolicy !== "visible" || statsQuery.isPending) return;
841 const visible = visibleStatsKeys.current;
@@ -919,6 +922,7 @@ export function PullRequestsPage() {
922 closeBatch,
923 hostActionsOf,
924 }));
925 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the pointer close-sweep sensor when the list changes or on unmount
926 useEffect(
927 () => () => closeSensorRef.current?.cancel(),
928 // oxlint-disable-next-line react/exhaustive-effect-dependencies -- The pointer sensor lives outside React; a new list under a sweep in progress must end it.
@@ -1014,6 +1018,7 @@ export function PullRequestsPage() {
1018 if (rightPanelState.isOpen) setMaximized((value) => !value);
1019 };
1020 const onGuideShown = () => setMaximized(true);
1021 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens the URL-linked pull request in the right panel store
1022 useEffect(() => {
1023 if (!pullRequestsSupported || rightPanelRef === null || linkedSelection === null) return;
1024 useRightPanelStore.getState().openPullRequest(rightPanelRef, linkedSelection);
@@ -1426,6 +1431,7 @@ export function PullRequestsPage() {
1431 event.stopPropagation();
1432 if (!event.repeat) toggleRightPanelMaximized();
1433 });
1434 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- document keydown listener for the right panel and copy-reference shortcuts
1435 useEffect(() => {
1436 const onKeyDown = (event: KeyboardEvent) => {
1437 if (event.defaultPrevented || isCommandPaletteOpen()) return;
apps/web/src/components/pullRequest/guide/GuideTour.tsx
+1
@@ -86,6 +86,7 @@ export function GuideTour({
86 event.preventDefault();
87 step(event.key === "j" ? 1 : -1);
88 });
89 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- document keydown listener for j/k tour stepping while the guide is active
90 useEffect(() => {
91 if (!active) return;
92 const onKeyDown = (event: KeyboardEvent) => stepFromKey(event);
apps/web/src/components/pullRequest/usePullRequestListView.ts
+1
@@ -185,6 +185,7 @@ export function usePullRequestScope(search: PullRequestsSearch) {
185
186 export function usePullRequestQueryFilters(search: PullRequestsSearch, typedQuery: string) {
187 const [sentQuery, setSentQuery] = useState(typedQuery);
188 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- debounce timer that sends the typed query after SEARCH_DEBOUNCE_MS
189 useEffect(() => {
190 const timer = window.setTimeout(() => setSentQuery(typedQuery), SEARCH_DEBOUNCE_MS);
191 return () => window.clearTimeout(timer);
apps/web/src/components/pullRequest/useThreadLinkedPullRequest.ts
+1
@@ -50,6 +50,7 @@ export function useThreadLinkedPullRequest(input: {
50
51 const relinkKeysRef = useRef(new Map<string, string>());
52 const relinkWriteRef = useRef(Promise.resolve());
53 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- persists the detected PR to the server thread once per change and retargets the open right panel store
54 useEffect(() => {
55 if (serverThreadRef === null) return;
56 const threadKey = scopedThreadKey(serverThreadRef);
apps/web/src/components/settings/AddEnvironmentDialog.tsx
+1
@@ -124,6 +124,7 @@ export function AddEnvironmentDialog({
124 // The discovery atom is kept alive across dialog opens, so re-read SSH config
125 // each time the SSH tab is shown; stale hosts stay visible while it refreshes.
126 const refreshDesktopSshHosts = desktopSshHosts.refresh;
127 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- rereads desktop SSH config through the bridge each time the SSH tab is shown
128 useEffect(() => {
129 if (isSshDiscoveryActive) refreshDesktopSshHosts();
130 }, [isSshDiscoveryActive, refreshDesktopSshHosts]);
apps/web/src/components/settings/CodexSetupSection.tsx
+5
@@ -315,6 +315,7 @@ function ManagedCodexSetup({
315 };
316 const abortOperation = () => operation.current?.abort();
317 // Once the card unmounts, nothing may start a sign-in or open a page on its behalf.
318 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- aborts the in-flight setup or sign-in AbortController on unmount
319 useEffect(() => () => operation.current?.abort(), []);
320 const [autoStartHandled, setAutoStartHandled] = useState(false);
321 const installed = installation?.installedVersion != null;
@@ -336,6 +337,7 @@ function ManagedCodexSetup({
337 }
338 // The server does not refresh the provider snapshot when a sign-in flow
339 // succeeds, and the flow can finish elsewhere (callback, pasted redirect URL).
340 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- asks the server to refresh the provider snapshot once the sign-in flow succeeds
341 useEffect(() => {
342 if (awaitingProvider && auth?.phase === "succeeded") {
343 void refreshProviders({ environmentId, input: { instanceId } });
@@ -405,6 +407,7 @@ function ManagedCodexSetup({
407 const transferFinishedProfile = useEffectEvent((profile: ChatGptTransferredProfile) =>
408 transferProfile(profile),
409 );
410 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- imports the finished handoff profile to the server once per attempt when the handoff query completes
411 useEffect(() => {
412 if (!handoff || handoffQuery.data?.phase !== "finished") return;
413 const attemptId = handoff.input.attemptId;
@@ -571,11 +574,13 @@ function ManagedCodexSetup({
574 onAutoStartConsumed();
575 void setup();
576 });
577 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- dispatches the automatic setup server command after the auto-start flag commits
578 useEffect(() => {
579 // oxlint-disable-next-line react/set-state-in-effect -- Starting setup dispatches a server command, which marks itself pending before it awaits.
580 if (autoStartHandled) startAutomatically();
581 }, [autoStartHandled]);
582
583 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the desktop bridge provider auth callback when the URL changes or the card unmounts
584 useEffect(() => {
585 if (!clientCallback || !url || !window.desktopBridge?.cancelProviderAuthCallback) return;
586 return () => {
apps/web/src/components/settings/FontFamilyPicker.tsx
+1
@@ -98,6 +98,7 @@ export function FontFamilyPicker({
98 // Base UI needs an initial closed commit; mounting open loses exit transitionend and leaves the popup
99 // stuck.
100 const [openAfterMount] = useState(initialOpen);
101 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens the Base UI popup after its first closed commit so the entrance transition is recorded
102 useEffect(() => {
103 // oxlint-disable-next-line react/set-state-in-effect -- Base UI needs one closed commit first to record the popup's entrance style.
104 if (openAfterMount) setOpen(true);
apps/web/src/components/settings/ProviderAuthTerminal.tsx
+1
@@ -20,6 +20,7 @@ export default function ProviderAuthTerminal({
20 // The surface captures its callbacks once at creation.
21 const respond = useStableCallback(onResponse);
22 const offset = outputOffset ?? output.length;
23 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- writes new auth output into the imperative Ghostty terminal surface
24 useEffect(() => {
25 if (!surface) return;
26 const delta = offset - written.current;
apps/web/src/components/settings/ProviderModelsSection.tsx
+1
@@ -156,6 +156,7 @@ export function ProviderModelsSection({
156 : displayModels;
157
158 // A model added or moved lands in a later commit, so each commit looks for the pending row.
159 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the pending model's DOM row into view once a later commit renders it
160 useEffect(() => {
161 const slug = scrollToSlugRef.current;
162 if (slug === null) return;
apps/web/src/components/settings/SavedEnvironmentRows.tsx
+1
@@ -504,6 +504,7 @@ function ConfiguredCloudLinkRow({ canManageRelay }: { readonly canManageRelay: b
504 const refreshLinkState = useEffectEvent(primaryCloudLinkState.refresh);
505 // The server rechecks reachability when the tunnel's 30 s readiness poll changes.
506 // Poll while mounted, so a failed read does not stop later ones.
507 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- 30 s interval that refreshes the cloud link reachability while mounted
508 useEffect(() => {
509 const interval = window.setInterval(() => refreshLinkState(), 30_000);
510 return () => window.clearInterval(interval);
apps/web/src/components/settings/SettingsFontPreviews.tsx
+2
@@ -156,6 +156,7 @@ export function TerminalFontPreview({ family, size }: { family: string; size: nu
156 const { theme, resolvedTheme } = useTheme();
157
158 // The box grows with the font so the whole transcript shows without scrolling.
159 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- applies the font to the Ghostty preview surface and resizes its DOM box to fit the rows
160 useEffect(() => {
161 if (!surface) return;
162 void surface.setFont(previewTerminalFont(family, size)).then(() => {
@@ -169,6 +170,7 @@ export function TerminalFontPreview({ family, size }: { family: string; size: nu
170 }, [surface, family, size]);
171
172 // Palette changes may preserve light/dark mode; re-read terminal tokens for every theme change.
173 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes theme tokens read from the DOM's computed styles into the Ghostty preview surface
174 useEffect(() => {
175 const mount = mountRef.current;
176 if (!mount || !surface) return;
apps/web/src/components/settings/SettingsSidebarNav.tsx
+2
@@ -143,6 +143,7 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
143 setActiveResultIndex(maxResultIndex);
144 }
145
146 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window keydown listener for the find and slash search shortcuts
147 useEffect(() => {
148 const handleKeyDown = (event: globalThis.KeyboardEvent) => {
149 if (event.defaultPrevented || event.isComposing) return;
@@ -178,6 +179,7 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
179 return () => window.removeEventListener("keydown", handleKeyDown);
180 }, []);
181
182 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- focuses the search input DOM node after the compact search opens
183 useEffect(() => {
184 if (compactSearchOpen) searchInputRef.current?.focus();
185 }, [compactSearchOpen]);
apps/web/src/components/settings/TelemetryExportSettings.tsx
+1
@@ -136,6 +136,7 @@ function TelemetryExportForm() {
136 if (check?.result === null) void sendCheck(key, signal, check.url);
137 }
138 });
139 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- sends pending endpoint check requests once the environment can run them
140 useEffect(() => {
141 // oxlint-disable-next-line react/set-state-in-effect -- State changes only after the response arrives.
142 if (canCheck) sendPendingChecks();
apps/web/src/components/settings/ThemeColorPicker.tsx
+1
@@ -249,6 +249,7 @@ function ThemeColorPicker({
249 }) {
250 const [committer] = useState(createFrameCommitter);
251 // Unmounting with the popover open (the editor closes mid-drag) never fires onOpenChange.
252 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- flushes the frame committer on unmount, since an open popover never fires onOpenChange
253 useEffect(() => committer.flush, [committer]);
254 return (
255 <Popover
apps/web/src/components/settings/ThemeEditorPanel.tsx
+4
@@ -434,11 +434,13 @@ export function ThemeEditorPanel({
434 }
435 }
436
437 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- applies the edited colors to the document as a live theme preview while the editor is open
438 useEffect(() => {
439 if (!open) return;
440 applyThemeColorPreview(colorsByAppearance[activeAppearance], activeAppearance);
441 }, [activeAppearance, colorsByAppearance, open]);
442
443 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- restores the document theme when the editor closes or unmounts
444 useEffect(() => {
445 if (!open) return;
446 return () => {
@@ -510,6 +512,7 @@ export function ThemeEditorPanel({
512 : [];
513 const selectedHighlightRolesKey = selectedHighlightRoles.join(",");
514
515 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- highlights role usage in the DOM, refreshed by a MutationObserver and resize and scroll listeners
516 useEffect(() => {
517 clearThemeInspectorHighlights();
518 if (!open || selectedRole === null || isInspecting) return;
@@ -570,6 +573,7 @@ export function ThemeEditorPanel({
573 };
574 }, [isInspecting, open, selectedHighlightRolesKey, selectedRole]);
575
576 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- document pointer, click and key listeners that drive the inspect-mode hover overlay
577 useEffect(() => {
578 if (!open || !isInspecting) {
579 clearThemeInspectorHover();
apps/web/src/components/settings/TypographySettings.tsx
+2
@@ -328,6 +328,7 @@ export function TypographySection() {
328 // rows without it would make terminal font edits do nothing. The rows follow the target
329 // directly so its row mounts in the first commit; the target clears once handled.
330 const searchTargetId = useSettingsSearchTargetId();
331 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- writes the advanced typography flag to localStorage when a search target needs it
332 useEffect(() => {
333 if (searchTargetId !== null) revealSettingsSearchTarget(searchTargetId);
334 }, [searchTargetId]);
@@ -398,6 +399,7 @@ function FontFamilySettingsRow({
399 setDraftSettled(true);
400 }
401 const readAdoptedGeneration = useEffectEvent(() => adopted.generation);
402 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the pending commit timer on unmount
403 useEffect(
404 () => () => {
405 if (commitTimerRef.current !== null) window.clearTimeout(commitTimerRef.current.id);
apps/web/src/components/settings/useSnapShotShortcutRecorder.tsx
+1
@@ -73,6 +73,7 @@ export function useSnapShotShortcutRecorder({
73 onError(error instanceof Error ? error.message : "Could not start shortcut recording.");
74 }
75 };
76 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- releases the desktop bridge's SnapShot shortcut suppression on unmount
77 useEffect(
78 () => () => {
79 requests.clear();
apps/web/src/components/sidebar/SidebarProviderUpdatePill.tsx
+2
@@ -111,6 +111,7 @@ export function SidebarProviderUpdatePill() {
111 setDismissAfterExitKey(null);
112 });
113
114 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- fallback timer that finishes the exit if the CSS transition never ends
115 useEffect(() => {
116 if (exitingKey === null) return;
117 // A cancelled or skipped CSS transition must not keep a hidden spinner mounted.
@@ -118,6 +119,7 @@ export function SidebarProviderUpdatePill() {
119 return () => window.clearTimeout(timeoutId);
120 }, [exitingKey]);
121
122 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- timer that dismisses the pill after it has been visible for dismissAfterVisibleMs
123 useEffect(() => {
124 if (!dismissAfterVisibleMs || !viewKey) {
125 return;
apps/web/src/components/ui/middle-truncate.tsx
+1
@@ -19,6 +19,7 @@ export function MiddleTruncate({
19 const split = splitForMiddleTruncate(value, tail);
20 const headRef = useRef<HTMLSpanElement>(null);
21 const head = split?.head;
22 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- fits the head span's DOM text and refits it through a ResizeObserver
23 useLayoutEffect(() => {
24 const element = headRef.current;
25 // A new head can keep the same box size, so refit here, not only on resize.
apps/web/src/components/ui/toast.tsx
+2
@@ -469,6 +469,7 @@ function ThreadToastVisibleAutoDismiss({
469 toastId: ToastId;
470 dismissAfterVisibleMs: number | undefined;
471 }) {
472 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- dismiss timer that pauses on visibilitychange, focus and blur so it only counts visible time
473 useEffect(() => {
474 if (!dismissAfterVisibleMs || dismissAfterVisibleMs <= 0) return;
475 if (typeof window === "undefined" || typeof document === "undefined") return;
@@ -558,6 +559,7 @@ function Toasts({ position }: { position: ToastPosition }) {
559 );
560 const visibleToastLayout = buildVisibleToastLayout(visibleToasts);
561
562 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- prunes the module-level remaining-time map of toasts the manager has dropped
563 useEffect(() => {
564 const activeToastIds = new Set(toasts.map((toast) => toast.id));
565 for (const toastId of threadToastVisibleTimeoutRemainingMs.keys()) {
apps/web/src/components/ui/tooltip.tsx
+1
@@ -64,6 +64,7 @@ function Tooltip<Payload>(props: TooltipPrimitive.Root.Props<Payload>) {
64 const tracker = use(TooltipScrollContext);
65 const localActionsRef = useRef<TooltipPrimitive.Root.Actions | null>(null);
66 const actionsRef = props.actionsRef ?? localActionsRef;
67 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- releases this tooltip from the scroll tracker on unmount
68 useEffect(() => () => tracker?.release(actionsRef), [actionsRef, tracker]);
69
70 if (!tracker) return <TooltipPrimitive.Root {...props} />;
apps/web/src/components/usage/UsageLimits.tsx
+1
@@ -102,6 +102,7 @@ function paceMarkStyles(timeLeft: number | null) {
102 export function usePaceMark(timeLeft: number | null) {
103 const [bar, setBar] = useState<HTMLElement | null>(null);
104 const [roomy, setRoomy] = useState(false);
105 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the bar DOM width before paint and remeasures through a ResizeObserver
106 useLayoutEffect(() => {
107 if (!bar) return;
108 const measure = () => setRoomy(bar.getBoundingClientRect().width >= 6);
apps/web/src/components/usage/UsageLimitsPooled.tsx
+1
@@ -252,6 +252,7 @@ function ActiveSegmentPopover({
252 // The trigger is gone, so the popup has nothing to anchor to: an exit transition would
253 // slide it to the viewport origin. Unmount it outright, which also clears Base UI's
254 // active-trigger bookkeeping so the segment can open again when it comes back.
255 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- closes the popover handle and unmounts the Base UI popup before paint when its trigger is gone
256 useLayoutEffect(() => {
257 if (available) return;
258 handle.close();
apps/web/src/components/usage/UsagePage.tsx
+3
@@ -153,6 +153,7 @@ function UsageModelDialogHost({
153 readonly onSetPrice: (model: string) => void;
154 }) {
155 const selectedKey = useAtomValue(selectedUsageModelKeyAtom);
156 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the shared selected-model atom on unmount
157 useEffect(() => () => selectUsageModel(null), []);
158 const model =
159 selectedKey === null
@@ -289,6 +290,7 @@ export function UsagePage() {
290 if (periodOption && !showingLimits) selectWindow(periodOption.days);
291 });
292
293 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window capture keydown listener for usage metric and period shortcuts
294 useEffect(() => {
295 globalThis.window.addEventListener("keydown", onUsageKeyDown, true);
296 return () => globalThis.window.removeEventListener("keydown", onUsageKeyDown, true);
@@ -335,6 +337,7 @@ export function UsagePage() {
337 const autoRefreshLimits = useEffectEvent(() => {
338 void refreshLimits(true);
339 });
340 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- refreshes provider limits from the server when the connected environment set changes
341 useEffect(() => {
342 if (showingLimits && connectedLimitsEnvironments) autoRefreshLimits();
343 }, [showingLimits, connectedLimitsEnvironments]);
apps/web/src/components/usage/UsageProviderChart.tsx
+1
@@ -331,6 +331,7 @@ function UsageChartPlot({
331 plot.style.setProperty("--usage-tooltip-top", `${top}px`);
332 };
333
334 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- positions the hover tooltip through plot CSS variables before paint and on ResizeObserver
335 useLayoutEffect(() => {
336 if (hoverIndex === null) return;
337 positionTooltip();
apps/web/src/hooks/FileMetadataThreadProvider.tsx
+1
@@ -29,6 +29,7 @@ export function FileMetadataThreadProvider(props: {
29 checkpoints: OrchestrationV2ThreadProjection["checkpoints"];
30 } | null>(null);
31
32 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- invalidates the server file metadata cache for files whose checkpoints changed
33 useEffect(() => {
34 if (!threadRef || !cwd || !checkpoints) {
35 previous.current = null;
apps/web/src/hooks/useCopyToClipboard.ts
+1
@@ -232,6 +232,7 @@ export function useCopyToClipboard<TContext = void>({
232 );
233 });
234
235 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the copied-state reset timer on unmount
236 React.useEffect(() => {
237 return (): void => {
238 if (timeoutIdRef.current) {
apps/web/src/hooks/useLiveRefresh.ts
+1
@@ -99,6 +99,7 @@ export function useLiveRefresh(
99 const fallbackViewId = useId();
100 const viewId = key ?? fallbackViewId;
101
102 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- refresh interval tied to page visibility and user interaction listeners
103 useEffect(() => {
104 if (!enabled) return;
105 const read = (now: number) => runRefresh(viewId, now);
apps/web/src/hooks/useProactivePanels.ts
+1
@@ -69,6 +69,7 @@ export function useProactivePanels(input: {
69 > | null>(null);
70 const threadKey = threadRef ? scopedThreadKey(threadRef) : null;
71
72 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens proactive surfaces in the right panel store as runs and linked PRs change
73 useEffect(() => {
74 if (threadKey === null || threadRef === null) {
75 proactivePanelObservationRef.current = null;
apps/web/src/hooks/useResizableWidth.ts
+1
@@ -89,6 +89,7 @@ export function useResizableWidth(options: UseResizableWidthOptions): {
89 // Bounds can change mid-drag (sidebar opens, window narrows), and the render
90 // that carries them rewrites the committed width, so re-apply the live pointer position.
91 const { refresh } = drag;
92 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reapplies the live drag pointer position to the DOM before paint when the bounds change
93 useLayoutEffect(() => refresh({ min: minWidth, max: maxWidth }), [refresh, minWidth, maxWidth]);
94
95 return {
apps/web/src/hooks/useStableCallback.ts
+1
@@ -7,6 +7,7 @@ export function useStableCallback<Args extends ReadonlyArray<unknown>, Result>(
7 const latest = useRef(fn);
8 // Insertion effects run before every layout effect in the commit, so a
9 // child's layout effect already calls this render's fn.
10 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- updates the ref during commit, before any layout effect can call the stable callback
11 useInsertionEffect(() => {
12 latest.current = fn;
13 });
apps/web/src/hooks/useWorkspaceMutationRefresh.ts
+1
@@ -16,6 +16,7 @@ export function useWorkspaceMutationRefresh(input: {
16 const { enabled = true, mutationId, refresh, resourceKey } = input;
17 const handledTokenRef = useRef<string | null>(null);
18
19 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- refetches the resource once per new workspace mutation token
20 useEffect(() => {
21 if (!enabled) return;
22 const token = workspaceMutationRefreshToken(resourceKey, mutationId);
apps/web/src/panelAnimations.ts
+2 -2
@@ -12,7 +12,7 @@ export function usePanelNavigationSuppression(navigationKey: string): boolean {
12 const [paintedNavigationKey, setPaintedNavigationKey] = useState<string | null>(null);
13 const suppressed = paintedNavigationKey !== navigationKey;
14
15 - // oxlint-disable-next-line t3code/react-effect-budget -- Wait two browser frames so the new route paints before panel animations are re-enabled; cancel the frames on change or unmount.
15 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Wait two browser frames so the new route paints before panel animations are re-enabled; cancel the frames on change or unmount.
16 useEffect(() => {
17 if (!suppressed) return;
18 let releaseFrame = 0;
@@ -56,7 +56,7 @@ export function usePanelPresence<T>(
56 if (open && !present) setPresent(true);
57 if (!open && !animated && present) setPresent(false);
58
59 - // oxlint-disable-next-line t3code/react-effect-budget -- Keep the closing panel mounted for its CSS exit transition, then unmount it; the timer is cleared on reopen or unmount.
59 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Keep the closing panel mounted for its CSS exit transition, then unmount it; the timer is cleared on reopen or unmount.
60 useEffect(() => {
61 if (open || !animated) return;
62 const timeout = window.setTimeout(() => setPresent(false), durationMs);
apps/web/src/routes/__root.tsx
+1
@@ -366,6 +366,7 @@ function EventRouter({
366 })().catch(() => undefined);
367 });
368
369 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- expands the bootstrap project in the UI store and navigates the router on a server welcome
370 useEffect(() => {
371 handleWelcome(serverWelcome);
372 }, [serverWelcome]);
apps/web/src/routes/_chat.index.tsx
+1
@@ -47,6 +47,7 @@ function IndexDraftLanding() {
47 sortScopedProjectsForSidebar(projects, threads, "updated_at")[0] ?? null;
48 const attempt = startState.retryRequest;
49
50 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- starts a draft thread in the most recent project and navigates to it while still on the index
51 useEffect(() => {
52 // Starting a draft after the user has left would replace the page they picked.
53 if (mostRecentProject === null || startedAttemptRef.current === attempt || !isStillOnIndex()) {
apps/web/src/shortcutModifierState.ts
+1
@@ -31,6 +31,7 @@ export function useShortcutModifierState(ignoreEditable = false): ShortcutModifi
31 const [state, setState] = useState(EMPTY_SHORTCUT_MODIFIER_STATE);
32 const stateRef = useRef(EMPTY_SHORTCUT_MODIFIER_STATE);
33
34 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window key, focus, paste and blur listeners that track held shortcut modifiers
35 useEffect(() => {
36 const updateState = (next: ShortcutModifierState) => {
37 if (areShortcutModifierStatesEqual(stateRef.current, next)) return;
apps/web/src/state/olderSettledShelf.ts
+2
@@ -36,6 +36,7 @@ export function useOlderSettledShelf(input: {
36 }));
37 const shelfKey = JSON.stringify(shelfScopes);
38 const shelf = useAtomValue(olderSettledThreads.shelfAtom(shelfScopes));
39 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- mounts the requested older settled pages into the thread family registry while shown
40 useEffect(() => {
41 const releases = (JSON.parse(shelfKey) as typeof shelfScopes).flatMap(({ scope, pages }) =>
42 pages === 0
@@ -89,6 +90,7 @@ export function useOlderSettledShelfGrowth(
90 visibleCount: shelf.visibleCount,
91 });
92 const { grow, pages } = shelf;
93 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- requests more older settled pages when the listed threads cannot fill the visible count
94 useEffect(() => {
95 if (wanted !== pages) grow(wanted);
96 }, [wanted, pages, grow]);
apps/web/src/state/peerLinks.ts
+1 -1
@@ -49,7 +49,7 @@ export function useLinkableMachines(environmentId: EnvironmentId, enabled: boole
49 const discoverIfUnasked = useEffectEvent(() => {
50 if (discovery.environments.size === 0 && !discovery.refreshing) void refreshDiscovery();
51 });
52 - // oxlint-disable-next-line t3code/react-effect-budget -- discovery follows the picker's visibility, which a card's mount or a dialog's open sets
52 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- discovery follows the picker's visibility, which a card's mount or a dialog's open sets
53 useEffect(() => {
54 if (enabled) discoverIfUnasked();
55 }, [enabled]);
apps/web/src/state/queries.ts
+2
@@ -82,6 +82,7 @@ const threadSearch = createThreadSearchResultsAtomFamily({
82 export function useDebouncedValue<A>(value: A, delayMs: number): A {
83 const [debounced, setDebounced] = useState(value);
84
85 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- debounce timer that publishes the value after delayMs
86 useEffect(() => {
87 const timer = window.setTimeout(() => {
88 setDebounced(value);
@@ -140,6 +141,7 @@ export function useThreadSearch(
141 : { query: "", matches: EMPTY_THREAD_SEARCH_MATCHES };
142 // The shown results' rows stay mounted until newer results replace them.
143 const shownKey = visible.query === "" ? null : searchKeyOf(visible.query);
144 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- mounts the shown search results' rows into the thread family registry until newer results replace them
145 useEffect(() => {
146 if (shownKey === null) return;
147 const environments = (JSON.parse(shownKey) as [ReadonlyArray<EnvironmentId>])[0];
apps/web/src/state/threads.ts
+1
@@ -47,6 +47,7 @@ export function useThreadFamily(
47 environmentId: EnvironmentId | null,
48 rootThreadId: ThreadId | null,
49 ): void {
50 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- mounts the subagent tree into the thread family registry while the caller shows it
51 useEffect(() => {
52 if (environmentId === null || rootThreadId === null) return;
53 return threadFamilies.mount(appAtomRegistry, environmentId, rootThreadId);
oxlint-plugin-t3code/index.ts
+2 -2
@@ -15,7 +15,7 @@ import noMobileUniwindThemeEscapeHatches from "./rules/no-mobile-uniwind-theme-e
15 import noAmbiguousDetailNavigation from "./rules/no-ambiguous-detail-navigation.ts";
16 import noMobilePullRequestGlyphLiterals from "./rules/no-mobile-pull-request-glyph-literals.ts";
17 import noNativeTitleTooltip from "./rules/no-native-title-tooltip.ts";
18 -import reactEffectBudget from "./rules/react-effect-budget.ts";
18 +import noUnreasonedStateSync from "./rules/no-unreasoned-state-sync.ts";
19 import requireRegisteredListScroll from "./rules/require-registered-list-scroll.ts";
20 import noOutsetStateIndicators from "./rules/no-outset-state-indicators.ts";
21 import noPollingLoopInTests from "./rules/no-polling-loop-in-tests.ts";
@@ -53,7 +53,7 @@ export default definePlugin({
53 "no-ambiguous-detail-navigation": noAmbiguousDetailNavigation,
54 "no-mobile-pull-request-glyph-literals": noMobilePullRequestGlyphLiterals,
55 "no-native-title-tooltip": noNativeTitleTooltip,
56 - "react-effect-budget": reactEffectBudget,
56 + "no-unreasoned-state-sync": noUnreasonedStateSync,
57 "require-registered-list-scroll": requireRegisteredListScroll,
58 "no-outset-state-indicators": noOutsetStateIndicators,
59 "no-polling-loop-in-tests": noPollingLoopInTests,
oxlint-plugin-t3code/rules/no-unreasoned-state-sync.test.ts new
+56
@@ -0,0 +1,56 @@
1 +import { assert, describe } from "@effect/vitest";
2 +
3 +import { createOxlintRuleHarness } from "../test/utils.ts";
4 +
5 +const reports = (output: string) =>
6 + output.match(/t3code\(no-unreasoned-state-sync\)/g)?.length ?? 0;
7 +const lint = (filename: string) =>
8 + createOxlintRuleHarness("t3code/no-unreasoned-state-sync", { filename });
9 +
10 +const component = lint("apps/web/src/Panel.tsx");
11 +
12 +describe("t3code/no-unreasoned-state-sync", () => {
13 + component.invalid(
14 + "reports every effect hook, including member calls",
15 + `import React, { useEffect } from "react";
16 +export function Panel() {
17 + useEffect(() => {}, []);
18 + React.useLayoutEffect(() => {});
19 + React.useInsertionEffect(() => {});
20 + return null;
21 +}
22 +`,
23 + (output) => assert.strictEqual(reports(output), 3),
24 + );
25 +
26 + component.valid(
27 + "ignores comments, strings and lookalike names",
28 + `// useEffect(() => {}) in a comment
29 +/* React.useLayoutEffect(() => {}) */
30 +const label = "useEffect(() => {})";
31 +const pipeline = Effect.matchCauseEffect(effect, {});
32 +const alias = useEffect;
33 +`,
34 + );
35 +
36 + component.valid(
37 + "accepts an effect whose suppression states its reason",
38 + `export function Panel() {
39 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to the window's resize events
40 + React.useEffect(() => {});
41 + return null;
42 +}
43 +`,
44 + );
45 +
46 + for (const filename of [
47 + "apps/web/src/Panel.test.tsx",
48 + "apps/web/src/Panel.spec.tsx",
49 + "apps/web/tests/Panel.tsx",
50 + ]) {
51 + lint(filename).valid(
52 + `skips ${filename}`,
53 + `export function Panel() { useEffect(() => {}); return null; }`,
54 + );
55 + }
56 +});
oxlint-plugin-t3code/rules/no-unreasoned-state-sync.ts new
+48
@@ -0,0 +1,48 @@
1 +import { defineRule, type ESTree } from "@oxlint/plugins";
2 +import * as Option from "effect/Option";
3 +
4 +import { getPropertyName, unwrapExpression } from "../utils.ts";
5 +
6 +const EFFECT_HOOKS = new Set(["useEffect", "useLayoutEffect", "useInsertionEffect"]);
7 +const EFFECT_HOOK_TEXT = /use(?:Layout|Insertion)?Effect/;
8 +const TEST_FILE = /\.(?:test|spec)\.[cm]?[jt]sx?$|[\\/](?:tests?|__tests__)[\\/]/;
9 +
10 +const isEffectHookCall = (node: ESTree.CallExpression): boolean => {
11 + const callee = unwrapExpression(node.callee);
12 + if (Option.isNone(callee)) return false;
13 + const expression = callee.value;
14 + if (expression.type === "Identifier") return EFFECT_HOOKS.has(expression.name);
15 + if (expression.type === "MemberExpression" && !expression.computed) {
16 + return Option.exists(getPropertyName(expression.property), (name) => EFFECT_HOOKS.has(name));
17 + }
18 + return false;
19 +};
20 +
21 +// Every kept effect carries its reason in the suppression above it; t3code/require-suppression-reason
22 +// rejects a suppression that does not say why.
23 +export default defineRule({
24 + meta: {
25 + type: "suggestion",
26 + docs: {
27 + description:
28 + "Report every React effect hook, the usual way state gets synchronized; one that stays says why.",
29 + },
30 + },
31 + create(context) {
32 + if (TEST_FILE.test(context.filename) || !EFFECT_HOOK_TEXT.test(context.sourceCode.text)) {
33 + return {};
34 + }
35 + return {
36 + CallExpression(node) {
37 + if (!isEffectHookCall(node)) return;
38 + context.report({
39 + node,
40 + message:
41 + "First ask whether this is synchronization that belongs in render or in the handler that causes it. " +
42 + "If an effect is the honest model, say why on the line above it: " +
43 + "`// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- <why>`.",
44 + });
45 + },
46 + };
47 + },
48 +});
oxlint-plugin-t3code/rules/react-effect-budget.test.ts deleted
-60
@@ -1,60 +0,0 @@
1 -import { assert, describe } from "@effect/vitest";
2 -
3 -import budget from "../../scripts/effect-budget.json" with { type: "json" };
4 -import { createOxlintRuleHarness } from "../test/utils.ts";
5 -
6 -const [budgetedFile, allowed] = Object.entries(budget)[0]!;
7 -
8 -const component = (effects: number) => `import React, { useEffect } from "react";
9 -export function Panel() {
10 -${Array.from({ length: effects }, (_, index) => (index % 2 === 0 ? " useEffect(() => {}, []);" : " React.useLayoutEffect(() => {});")).join("\n")}
11 - return null;
12 -}
13 -`;
14 -
15 -const reports = (output: string) => output.match(/t3code\(react-effect-budget\)/g)?.length ?? 0;
16 -const lint = (filename: string) =>
17 - createOxlintRuleHarness("t3code/react-effect-budget", { filename });
18 -
19 -const budgeted = lint(budgetedFile);
20 -const unbudgeted = lint("apps/web/src/NotInTheBudget.tsx");
21 -
22 -describe("t3code/react-effect-budget", () => {
23 - budgeted.valid("passes a file at its budget", component(allowed));
24 -
25 - budgeted.invalid("reports only the calls past the budget", component(allowed + 2), (output) => {
26 - assert.strictEqual(reports(output), 2);
27 - assert.include(output, `has ${allowed + 2} React effects against a budget of ${allowed}`);
28 - });
29 -
30 - unbudgeted.invalid(
31 - "gives a file without an entry a budget of 0, counting member calls",
32 - `export function New() { React.useEffect(() => {}); return null; }`,
33 - (output) => {
34 - assert.strictEqual(reports(output), 1);
35 - assert.include(output, "has 1 React effect against a budget of 0");
36 - },
37 - );
38 -
39 - unbudgeted.valid(
40 - "ignores comments, strings and lookalike names",
41 - `// useEffect(() => {}) in a comment
42 -/* React.useLayoutEffect(() => {}) */
43 -const label = "useEffect(() => {})";
44 -const pipeline = Effect.matchCauseEffect(effect, {});
45 -const alias = useEffect;
46 -`,
47 - );
48 -
49 - unbudgeted.valid(
50 - "does not count an effect that states its reason",
51 - `export function New() {
52 - // oxlint-disable-next-line t3code/react-effect-budget -- subscribes to the window's resize events
53 - React.useEffect(() => {});
54 - return null;
55 -}
56 -`,
57 - );
58 -
59 - lint("apps/web/src/Panel.test.tsx").valid("skips test files", component(3));
60 -});
oxlint-plugin-t3code/rules/react-effect-budget.ts deleted
-71
@@ -1,71 +0,0 @@
1 -import { defineRule, type ESTree } from "@oxlint/plugins";
2 -import * as Option from "effect/Option";
3 -
4 -import budget from "../../scripts/effect-budget.json" with { type: "json" };
5 -import { getPropertyName, unwrapExpression } from "../utils.ts";
6 -
7 -const BUDGET_FILE = "scripts/effect-budget.json";
8 -const EFFECT_HOOKS = new Set(["useEffect", "useLayoutEffect", "useInsertionEffect"]);
9 -const EFFECT_HOOK_TEXT = /use(?:Layout|Insertion)?Effect/;
10 -const UNBUDGETED_FILE = /\.test\.[cm]?[jt]sx?$|[\\/](?:test|__tests__)[\\/]/;
11 -const budgets: Readonly<Record<string, number>> = budget;
12 -const JUSTIFIED = /oxlint-disable-next-line[^\n]*t3code\/react-effect-budget\s+--\s*\S/;
13 -
14 -// An effect with a stated reason on the line above is a reviewed decision: it is not counted, and it
15 -// is always reported so that the suppression comment above it is used.
16 -const isJustified = (lines: ReadonlyArray<string>, line: number): boolean =>
17 - JUSTIFIED.test(lines[line - 2] ?? "");
18 -
19 -const isEffectHookCall = (node: ESTree.CallExpression): boolean => {
20 - const callee = unwrapExpression(node.callee);
21 - if (Option.isNone(callee)) return false;
22 - const expression = callee.value;
23 - if (expression.type === "Identifier") return EFFECT_HOOKS.has(expression.name);
24 - if (expression.type === "MemberExpression" && !expression.computed) {
25 - return Option.exists(getPropertyName(expression.property), (name) => EFFECT_HOOKS.has(name));
26 - }
27 - return false;
28 -};
29 -
30 -// Budget keys are repo-relative; matching on the path's end also works for files linted elsewhere.
31 -const budgetFor = (filename: string): number => {
32 - const normalized = filename.replaceAll("\\", "/");
33 - const key = Object.keys(budgets).find((file) => normalized.endsWith(`/${file}`));
34 - return key === undefined ? 0 : budgets[key]!;
35 -};
36 -
37 -export default defineRule({
38 - meta: {
39 - type: "suggestion",
40 - docs: {
41 - description: `Hold each file to the React effect hooks it is allowed in ${BUDGET_FILE}; a missing entry allows none.`,
42 - },
43 - },
44 - create(context) {
45 - if (UNBUDGETED_FILE.test(context.filename) || !EFFECT_HOOK_TEXT.test(context.sourceCode.text)) {
46 - return {};
47 - }
48 - const lines = context.sourceCode.text.split("\n");
49 - const calls: Array<ESTree.CallExpression> = [];
50 - const justified: Array<ESTree.CallExpression> = [];
51 - return {
52 - CallExpression(node) {
53 - if (!isEffectHookCall(node)) return;
54 - (isJustified(lines, node.loc.start.line) ? justified : calls).push(node);
55 - },
56 - "Program:exit"() {
57 - for (const node of justified) {
58 - context.report({ node, message: "A React effect with a stated reason." });
59 - }
60 - const allowed = budgetFor(context.filename);
61 - if (calls.length <= allowed) return;
62 - const message =
63 - `This file has ${calls.length} React ${calls.length === 1 ? "effect" : "effects"} against a budget of ${allowed}. ` +
64 - "First ask whether this is synchronization that belongs in render or in the handler that causes it. " +
65 - "If an effect is the honest model, say why on the line above it: " +
66 - "`// oxlint-disable-next-line t3code/react-effect-budget -- <why>`.";
67 - for (const node of calls.slice(allowed)) context.report({ node, message });
68 - },
69 - };
70 - },
71 -});
scripts/effect-budget.json deleted
-436
@@ -1,436 +0,0 @@
1 -{
2 - "apps/mobile/src/App.tsx": 2,
3 - "apps/mobile/src/Stack.tsx": 1,
4 - "apps/mobile/src/components/ComposerAttachmentStrip.tsx": 2,
5 - "apps/mobile/src/components/ComposerContextAttachment.tsx": 1,
6 - "apps/mobile/src/components/ComposerEditor.tsx": 2,
7 - "apps/mobile/src/components/FilePreview.ios.tsx": 1,
8 - "apps/mobile/src/components/FilePreview.tsx": 1,
9 - "apps/mobile/src/components/FilePreviewModal.tsx": 5,
10 - "apps/mobile/src/components/MediaVideoPlayer.tsx": 2,
11 - "apps/mobile/src/components/PdfPreview.android.tsx": 1,
12 - "apps/mobile/src/components/ProjectFavicon.tsx": 1,
13 - "apps/mobile/src/components/VideoPreviewModal.ios.tsx": 6,
14 - "apps/mobile/src/components/VideoPreviewModal.tsx": 3,
15 - "apps/mobile/src/components/VideoThumbnailImage.tsx": 1,
16 - "apps/mobile/src/components/ui/AndroidAnchoredMenu.tsx": 1,
17 - "apps/mobile/src/components/ui/AppBar.android.tsx": 1,
18 - "apps/mobile/src/components/ui/Dialog.android.tsx": 1,
19 - "apps/mobile/src/components/ui/Notice.tsx": 1,
20 - "apps/mobile/src/components/ui/OverlayPortal.tsx": 3,
21 - "apps/mobile/src/components/ui/SliderRow.android.tsx": 1,
22 - "apps/mobile/src/components/ui/SliderRow.tsx": 1,
23 - "apps/mobile/src/components/ui/Toast.tsx": 2,
24 - "apps/mobile/src/features/agent-awareness/notificationNavigation.ts": 3,
25 - "apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx": 2,
26 - "apps/mobile/src/features/browser/PreviewStreamWebView.tsx": 5,
27 - "apps/mobile/src/features/browser/ThreadBrowserFloat.tsx": 2,
28 - "apps/mobile/src/features/cloud/CloudAuthProvider.tsx": 3,
29 - "apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx": 1,
30 - "apps/mobile/src/features/cloud/connectOnboardingNavigation.ts": 1,
31 - "apps/mobile/src/features/cloud/managedRelayState.ts": 1,
32 - "apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx": 5,
33 - "apps/mobile/src/features/connection/PermissionUpdateNotice.tsx": 2,
34 - "apps/mobile/src/features/devices/DevicePreviewRouteScreen.tsx": 6,
35 - "apps/mobile/src/features/devices/DeviceStreamWebView.tsx": 2,
36 - "apps/mobile/src/features/diagnostics/SettingsDiagnosticsRouteScreen.tsx": 1,
37 - "apps/mobile/src/features/diffs/nativeReviewDiffSurface.ts": 3,
38 - "apps/mobile/src/features/files/AttachmentFileScreen.tsx": 1,
39 - "apps/mobile/src/features/files/AudioFilePreview.tsx": 2,
40 - "apps/mobile/src/features/files/FileTreeBrowser.tsx": 3,
41 - "apps/mobile/src/features/files/FilesHeader.tsx": 1,
42 - "apps/mobile/src/features/files/SourceFileSurface.tsx": 1,
43 - "apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx": 1,
44 - "apps/mobile/src/features/files/WorkspaceFileWebPreview.tsx": 1,
45 - "apps/mobile/src/features/files/useFileTreeEntries.ts": 1,
46 - "apps/mobile/src/features/home/HomeRouteScreen.tsx": 2,
47 - "apps/mobile/src/features/home/HomeScreen.tsx": 4,
48 - "apps/mobile/src/features/home/ThreadListToolbar.tsx": 1,
49 - "apps/mobile/src/features/home/WorkspaceConnectionTitle.tsx": 2,
50 - "apps/mobile/src/features/home/home-list-options.ts": 1,
51 - "apps/mobile/src/features/home/home-route-visibility.ts": 1,
52 - "apps/mobile/src/features/home/thread-swipe-actions.tsx": 5,
53 - "apps/mobile/src/features/keyboard/CommandPalette.tsx": 2,
54 - "apps/mobile/src/features/keyboard/HardwareKeyboardCommandProvider.tsx": 1,
55 - "apps/mobile/src/features/keyboard/hardwareKeyboardCommands.ts": 1,
56 - "apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx": 3,
57 - "apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx": 1,
58 - "apps/mobile/src/features/layout/workspace-inspector-pane.tsx": 2,
59 - "apps/mobile/src/features/projects/AddProjectScreen.tsx": 2,
60 - "apps/mobile/src/features/prompt-links/usePromptLinkResolver.ts": 1,
61 - "apps/mobile/src/features/prompt-links/useThreadPromptLink.ts": 1,
62 - "apps/mobile/src/features/pull-requests/PullRequestFilterMenuContext.tsx": 1,
63 - "apps/mobile/src/features/pull-requests/PullRequestReviewersScreen.tsx": 1,
64 - "apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx": 4,
65 - "apps/mobile/src/features/pull-requests/PullRequestToolbar.android.tsx": 1,
66 - "apps/mobile/src/features/pull-requests/PullRequestsScreen.tsx": 1,
67 - "apps/mobile/src/features/pull-requests/guide/PullRequestGuideScreen.tsx": 1,
68 - "apps/mobile/src/features/pull-requests/usePullRequestDiff.ts": 1,
69 - "apps/mobile/src/features/pull-requests/usePullRequestEnvironmentFallback.ts": 1,
70 - "apps/mobile/src/features/pull-requests/usePullRequestFilesViewed.ts": 4,
71 - "apps/mobile/src/features/pull-requests/usePullRequestList.ts": 3,
72 - "apps/mobile/src/features/pull-requests/usePullRequestReviewDraft.ts": 1,
73 - "apps/mobile/src/features/review/ReviewSheet.tsx": 1,
74 - "apps/mobile/src/features/review/useNativeReviewDiffHighlighting.ts": 2,
75 - "apps/mobile/src/features/review/useReviewCommentSelectionController.ts": 2,
76 - "apps/mobile/src/features/review/useReviewDiffData.ts": 2,
77 - "apps/mobile/src/features/review/useReviewDiffPrewarming.ts": 1,
78 - "apps/mobile/src/features/review/useReviewSections.ts": 5,
79 - "apps/mobile/src/features/settings/OutdatedServerUpdateSection.tsx": 1,
80 - "apps/mobile/src/features/settings/SettingsAboutRouteScreen.tsx": 1,
81 - "apps/mobile/src/features/settings/SettingsAuthRouteScreen.tsx": 2,
82 - "apps/mobile/src/features/settings/SettingsEnvironmentDetailRouteScreen.tsx": 1,
83 - "apps/mobile/src/features/settings/SettingsMicrophoneRouteScreen.tsx": 1,
84 - "apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx": 2,
85 - "apps/mobile/src/features/settings/SettingsProjectOverviewRouteScreen.tsx": 1,
86 - "apps/mobile/src/features/settings/SettingsScheduledTasksRouteScreen.tsx": 2,
87 - "apps/mobile/src/features/settings/appearance/AppearancePreferencesProvider.tsx": 2,
88 - "apps/mobile/src/features/settings/components/BranchNamingSettings.tsx": 1,
89 - "apps/mobile/src/features/settings/components/SettingsLegalDocumentRouteScreen.tsx": 1,
90 - "apps/mobile/src/features/sharing/IncomingShareProvider.tsx": 4,
91 - "apps/mobile/src/features/showcase/ShowcaseCaptureCoordinator.tsx": 11,
92 - "apps/mobile/src/features/terminal/NativeTerminalSurface.tsx": 4,
93 - "apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx": 14,
94 - "apps/mobile/src/features/terminal/terminalLaunchContext.ts": 1,
95 - "apps/mobile/src/features/terminal/useTerminalGridSync.ts": 1,
96 - "apps/mobile/src/features/terminal/useTerminalLifecycle.ts": 1,
97 - "apps/mobile/src/features/threads/ComposerPopoverAnchor.android.tsx": 2,
98 - "apps/mobile/src/features/threads/ComposerPopoverAnchor.tsx": 1,
99 - "apps/mobile/src/features/threads/CopyTextButton.tsx": 1,
100 - "apps/mobile/src/features/threads/CustomSnoozeSheet.android.tsx": 1,
101 - "apps/mobile/src/features/threads/GitActionProgressOverlay.tsx": 1,
102 - "apps/mobile/src/features/threads/HtmlRenderWebView.tsx": 1,
103 - "apps/mobile/src/features/threads/McpAppFullscreenScreen.tsx": 1,
104 - "apps/mobile/src/features/threads/McpAppWebView.tsx": 7,
105 - "apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx": 2,
106 - "apps/mobile/src/features/threads/NewTaskDraftRouteScreen.tsx": 5,
107 - "apps/mobile/src/features/threads/NewTaskDraftScreen.tsx": 10,
108 - "apps/mobile/src/features/threads/NewTaskRouteScreen.tsx": 1,
109 - "apps/mobile/src/features/threads/QuestionAttachments.tsx": 2,
110 - "apps/mobile/src/features/threads/ThreadAgentsSheet.tsx": 1,
111 - "apps/mobile/src/features/threads/ThreadArrangementSheet.tsx": 3,
112 - "apps/mobile/src/features/threads/ThreadComposer.tsx": 6,
113 - "apps/mobile/src/features/threads/ThreadDetailScreen.tsx": 20,
114 - "apps/mobile/src/features/threads/ThreadFeed.tsx": 14,
115 - "apps/mobile/src/features/threads/ThreadGuestShareBar.tsx": 1,
116 - "apps/mobile/src/features/threads/ThreadInlineFilePreview.tsx": 2,
117 - "apps/mobile/src/features/threads/ThreadMarkdownImage.tsx": 3,
118 - "apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx": 3,
119 - "apps/mobile/src/features/threads/ThreadQueueControl.tsx": 2,
120 - "apps/mobile/src/features/threads/ThreadRouteScreen.tsx": 3,
121 - "apps/mobile/src/features/threads/ThreadScreenHost.tsx": 2,
122 - "apps/mobile/src/features/threads/ThreadSettingsSheet.tsx": 2,
123 - "apps/mobile/src/features/threads/UsageLimitRecoveryCard.tsx": 1,
124 - "apps/mobile/src/features/threads/floating-working-control.tsx": 2,
125 - "apps/mobile/src/features/threads/git/GitOverviewSheet.tsx": 1,
126 - "apps/mobile/src/features/threads/new-task-flow-provider.tsx": 6,
127 - "apps/mobile/src/features/threads/thread-inspector-content-stack.tsx": 1,
128 - "apps/mobile/src/features/threads/thread-list-v2-items.tsx": 1,
129 - "apps/mobile/src/features/threads/thread-subagent-group.tsx": 2,
130 - "apps/mobile/src/features/threads/thread-work-log.tsx": 5,
131 - "apps/mobile/src/features/threads/use-composer-command-menu.ts": 5,
132 - "apps/mobile/src/features/threads/use-thread-settings-sheet-presentation.ts": 2,
133 - "apps/mobile/src/features/threads/use-visible-second-clock.ts": 2,
134 - "apps/mobile/src/features/threads/use-worktree-setup.ts": 1,
135 - "apps/mobile/src/features/threads/useFileChipShare.ts": 2,
136 - "apps/mobile/src/features/usage/UsageLimitsSection.tsx": 1,
137 - "apps/mobile/src/features/usage/UsageRouteScreen.tsx": 1,
138 - "apps/mobile/src/features/voice-input/ComposerDictationControl.tsx": 3,
139 - "apps/mobile/src/features/voice-input/GlobalVoiceInputControl.tsx": 2,
140 - "apps/mobile/src/features/voice-input/VoiceInputProvider.tsx": 4,
141 - "apps/mobile/src/features/voice-input/useVoiceInputController.ts": 1,
142 - "apps/mobile/src/features/workspace/AndroidWorkspaceTabsProvider.tsx": 1,
143 - "apps/mobile/src/features/workspace/WorkspaceNativeTabs.ios.tsx": 1,
144 - "apps/mobile/src/features/workspace/WorkspaceTabsContext.tsx": 1,
145 - "apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx": 1,
146 - "apps/mobile/src/features/workspace/WorkspaceToolbar.tsx": 2,
147 - "apps/mobile/src/lib/useMediaVideoPlayback.ts": 1,
148 - "apps/mobile/src/lib/attachmentDocument.ts": 4,
149 - "apps/mobile/src/lib/useDelayedStatus.ts": 2,
150 - "apps/mobile/src/lib/useUiRuntimeMemoryWarningGc.ts": 1,
151 - "apps/mobile/src/lib/videoAudioSession.ts": 1,
152 - "apps/mobile/src/native/NativeHeaderToolbar.tsx": 2,
153 - "apps/mobile/src/native/NativeWorkspaceColumns.ios.tsx": 1,
154 - "apps/mobile/src/native/StackHeader.tsx": 2,
155 - "apps/mobile/src/native/T3ComposerEditor.ios.tsx": 2,
156 - "apps/mobile/src/native/T3ComposerEditor.native.tsx": 2,
157 - "apps/mobile/src/native/V5StackHeader.ios.tsx": 1,
158 - "apps/mobile/src/native/useRetryingImageSource.ts": 1,
159 - "apps/mobile/src/state/composer-attachment-uploads.ts": 2,
160 - "apps/mobile/src/state/mediaActions.ts": 1,
161 - "apps/mobile/src/state/olderSettledShelf.ts": 2,
162 - "apps/mobile/src/state/queries.ts": 2,
163 - "apps/mobile/src/state/thread-order.ts": 1,
164 - "apps/mobile/src/state/threads.ts": 1,
165 - "apps/mobile/src/state/use-composer-attachment-actions.ts": 1,
166 - "apps/mobile/src/state/use-composer-drafts.ts": 3,
167 - "apps/mobile/src/state/use-pull-to-refresh.ts": 1,
168 - "apps/mobile/src/state/use-selected-thread-git-actions.ts": 1,
169 - "apps/mobile/src/state/use-selected-thread-requests.ts": 2,
170 - "apps/mobile/src/state/use-thread-composer-state.ts": 3,
171 - "apps/mobile/src/state/use-thread-outbox-drain.ts": 4,
172 - "apps/mobile/src/state/use-thread-pr.ts": 1,
173 - "apps/mobile/src/state/use-vcs-action-state.ts": 1,
174 - "apps/mobile/src/widgets/SubscriptionUsageCoordinator.tsx": 1,
175 - "apps/mobile/src/widgets/useSubscriptionUsage.ts": 1,
176 - "apps/web/src/AppRoot.tsx": 1,
177 - "apps/web/src/browser/BrowserProfileReporter.tsx": 1,
178 - "apps/web/src/browser/BrowserSurfaceSlot.tsx": 2,
179 - "apps/web/src/browser/ElectronBrowserHost.tsx": 3,
180 - "apps/web/src/browser/HostedBrowserWebview.tsx": 6,
181 - "apps/web/src/browser/ServerBrowserSurface.tsx": 5,
182 - "apps/web/src/browser/useBrowserViewportResize.ts": 2,
183 - "apps/web/src/cloud/managedAuth.tsx": 2,
184 - "apps/web/src/cloud/managedRelayState.ts": 2,
185 - "apps/web/src/components/AddProjectToMachineDialog.tsx": 1,
186 - "apps/web/src/components/AnimatedHeight.tsx": 2,
187 - "apps/web/src/components/AnimatedWidth.tsx": 1,
188 - "apps/web/src/components/AppSidebarLayout.tsx": 4,
189 - "apps/web/src/components/BackgroundThreadAnnouncer.tsx": 1,
190 - "apps/web/src/components/BranchPicker.tsx": 2,
191 - "apps/web/src/components/BranchToolbar.tsx": 4,
192 - "apps/web/src/components/BranchToolbarBranchSelector.tsx": 1,
193 - "apps/web/src/components/ChatMarkdown.tsx": 1,
194 - "apps/web/src/components/ChatView.tsx": 23,
195 - "apps/web/src/components/CommandPalette.tsx": 5,
196 - "apps/web/src/components/CommandPaletteContent.tsx": 1,
197 - "apps/web/src/components/ComposerPromptEditorTiptap.tsx": 13,
198 - "apps/web/src/components/ConfirmDialogHost.tsx": 1,
199 - "apps/web/src/components/CustomSnoozeDialog.tsx": 1,
200 - "apps/web/src/components/DiffPanel.tsx": 4,
201 - "apps/web/src/components/DiffWorkerPoolProvider.tsx": 2,
202 - "apps/web/src/components/GitActionsControl.tsx": 4,
203 - "apps/web/src/components/HostFreezeToastCoordinator.tsx": 1,
204 - "apps/web/src/components/LegacySidebar.tsx": 5,
205 - "apps/web/src/components/LegacyThreadMigrationToast.tsx": 2,
206 - "apps/web/src/components/PermissionUpdateNotice.tsx": 1,
207 - "apps/web/src/components/PersistentThreadTerminals.tsx": 1,
208 - "apps/web/src/components/ProjectCloneToastCoordinator.tsx": 2,
209 - "apps/web/src/components/PullRequestThreadDialog.tsx": 1,
210 - "apps/web/src/components/QuitHoldOverlay.tsx": 1,
211 - "apps/web/src/components/ReopenClosedViewShortcut.tsx": 2,
212 - "apps/web/src/components/RightPanelTabs.tsx": 5,
213 - "apps/web/src/components/Sidebar.logic.ts": 2,
214 - "apps/web/src/components/Sidebar.pointer.ts": 1,
215 - "apps/web/src/components/Sidebar.tsx": 10,
216 - "apps/web/src/components/SlowRpcRequestToastCoordinator.tsx": 2,
217 - "apps/web/src/components/ThreadNotificationCoordinator.tsx": 5,
218 - "apps/web/src/components/ThreadRouteView.tsx": 5,
219 - "apps/web/src/components/ThreadTerminalDrawer.tsx": 13,
220 - "apps/web/src/components/auth/ConnectAgentSurface.tsx": 1,
221 - "apps/web/src/components/auth/PairingRouteSurface.tsx": 2,
222 - "apps/web/src/components/chat/AgentElapsed.tsx": 1,
223 - "apps/web/src/components/chat/AssistantCitationChip.tsx": 2,
224 - "apps/web/src/components/chat/AssistantCitationSource.tsx": 1,
225 - "apps/web/src/components/chat/AssistantSelectionToolbar.tsx": 2,
226 - "apps/web/src/components/chat/ChangedFilesTree.tsx": 1,
227 - "apps/web/src/components/chat/ChatCanvas.tsx": 1,
228 - "apps/web/src/components/chat/ChatComposer.tsx": 26,
229 - "apps/web/src/components/chat/ChatHeader.tsx": 2,
230 - "apps/web/src/components/chat/ChatMarkdownMedia.tsx": 1,
231 - "apps/web/src/components/chat/ChatOverlayHosts.tsx": 1,
232 - "apps/web/src/components/chat/CommandOutputPanel.tsx": 1,
233 - "apps/web/src/components/chat/ComposerAttachmentStrip.tsx": 1,
234 - "apps/web/src/components/chat/ComposerBannerStack.tsx": 3,
235 - "apps/web/src/components/chat/ComposerCommandMenu.tsx": 1,
236 - "apps/web/src/components/chat/ComposerCommandMenuLayer.tsx": 1,
237 - "apps/web/src/components/chat/ComposerImageThumbnail.tsx": 1,
238 - "apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx": 2,
239 - "apps/web/src/components/chat/ComposerStashMenu.tsx": 2,
240 - "apps/web/src/components/chat/DraftHeroHeadline.tsx": 1,
241 - "apps/web/src/components/chat/DraftHeroProjectHeading.tsx": 1,
242 - "apps/web/src/components/chat/ExpandedImageDialog.tsx": 4,
243 - "apps/web/src/components/chat/HtmlRenderFrame.tsx": 3,
244 - "apps/web/src/components/chat/MarkdownCodeBlock.tsx": 3,
245 - "apps/web/src/components/chat/MarkdownTable.tsx": 3,
246 - "apps/web/src/components/chat/McpAppFrame.tsx": 10,
247 - "apps/web/src/components/chat/MermaidDiagram.tsx": 1,
248 - "apps/web/src/components/chat/MessagesTimeline.tsx": 10,
249 - "apps/web/src/components/chat/ModelPickerContent.tsx": 4,
250 - "apps/web/src/components/chat/ModelPickerSidebar.tsx": 1,
251 - "apps/web/src/components/chat/OpenInPicker.tsx": 1,
252 - "apps/web/src/components/chat/OpenInPickerShortcut.ts": 1,
253 - "apps/web/src/components/chat/PierreEntryIcon.tsx": 1,
254 - "apps/web/src/components/chat/ProviderModelPicker.tsx": 1,
255 - "apps/web/src/components/chat/ProviderSubagentBar.tsx": 1,
256 - "apps/web/src/components/chat/ThreadActivityAnnouncer.tsx": 1,
257 - "apps/web/src/components/chat/ThreadDetailsCard.tsx": 4,
258 - "apps/web/src/components/chat/ThreadFindBar.tsx": 1,
259 - "apps/web/src/components/chat/ThreadFindProvider.tsx": 1,
260 - "apps/web/src/components/chat/ThreadTimeline.tsx": 1,
261 - "apps/web/src/components/chat/ThreadVisitWatermark.tsx": 2,
262 - "apps/web/src/components/chat/TimelineMinimap.tsx": 1,
263 - "apps/web/src/components/chat/TimelineWorkGroupRows.tsx": 3,
264 - "apps/web/src/components/chat/UsageLimitRecoveryBanner.tsx": 1,
265 - "apps/web/src/components/chat/WorkLog.tsx": 1,
266 - "apps/web/src/components/chat/WorktreeSetupCard.tsx": 1,
267 - "apps/web/src/components/chat/ZoomableImage.tsx": 3,
268 - "apps/web/src/components/chat/composerContextUndo.ts": 1,
269 - "apps/web/src/components/chat/threadContextDrag.ts": 1,
270 - "apps/web/src/components/chat/threadFindHighlights.ts": 3,
271 - "apps/web/src/components/chat/useAssistantCitationTarget.ts": 2,
272 - "apps/web/src/components/chat/useAttachmentPreviewHandoff.ts": 4,
273 - "apps/web/src/components/chat/useChatShortcuts.ts": 1,
274 - "apps/web/src/components/chat/useComposerCommandKey.ts": 1,
275 - "apps/web/src/components/chat/useComposerMultilinePrompt.ts": 1,
276 - "apps/web/src/components/chat/useComposerRestingTransition.ts": 5,
277 - "apps/web/src/components/chat/useComposerSend.ts": 1,
278 - "apps/web/src/components/chat/useComposerStash.ts": 2,
279 - "apps/web/src/components/chat/useComposerTypingGuard.ts": 1,
280 - "apps/web/src/components/chat/useDraftEnvironmentRouting.ts": 3,
281 - "apps/web/src/components/chat/useDraftHeroLayoutTransition.ts": 1,
282 - "apps/web/src/components/chat/usePasteToFocusComposer.ts": 1,
283 - "apps/web/src/components/chat/usePendingThreadRequests.ts": 2,
284 - "apps/web/src/components/chat/useProviderWorkspaceSnapshotRefresh.ts": 2,
285 - "apps/web/src/components/chat/useQueuedRunEdit.ts": 1,
286 - "apps/web/src/components/chat/useRestingComposerControlsLayout.ts": 1,
287 - "apps/web/src/components/chat/useRightPanelActions.ts": 1,
288 - "apps/web/src/components/chat/useSystemComposerBanners.tsx": 1,
289 - "apps/web/src/components/chat/useThreadFind.ts": 6,
290 - "apps/web/src/components/chat/useThreadFindNavigation.ts": 5,
291 - "apps/web/src/components/chat/useThreadFindPositionReader.ts": 1,
292 - "apps/web/src/components/chat/useThreadLifecycle.tsx": 1,
293 - "apps/web/src/components/chat/useTimelineFollow.ts": 6,
294 - "apps/web/src/components/chat/useTimelinePositionRestore.ts": 2,
295 - "apps/web/src/components/cloud/CloudEnvironmentConnectList.tsx": 3,
296 - "apps/web/src/components/cloud/ConnectCliAuthSurface.tsx": 1,
297 - "apps/web/src/components/contextChipParts.tsx": 1,
298 - "apps/web/src/components/desktop/DesktopAppActivationCoordinator.tsx": 1,
299 - "apps/web/src/components/desktop/DesktopWebLinkCoordinator.tsx": 1,
300 - "apps/web/src/components/desktop/SnapShotCoordinator.tsx": 2,
301 - "apps/web/src/components/desktop/SshPasswordPromptDialog.tsx": 3,
302 - "apps/web/src/components/device/DeviceAndroidFoldControls.tsx": 2,
303 - "apps/web/src/components/device/DeviceDuoViewport.tsx": 4,
304 - "apps/web/src/components/device/DevicePanel.tsx": 1,
305 - "apps/web/src/components/device/DevicePhoneViewport.tsx": 3,
306 - "apps/web/src/components/device/DeviceSetup.tsx": 1,
307 - "apps/web/src/components/device/DeviceStreamView.tsx": 4,
308 - "apps/web/src/components/device/DeviceToolsPanel.tsx": 1,
309 - "apps/web/src/components/device/DeviceWorkspace.tsx": 1,
310 - "apps/web/src/components/device/useDeviceControls.ts": 2,
311 - "apps/web/src/components/diffs/DiffCommentAnnotation.tsx": 1,
312 - "apps/web/src/components/diffs/DiffFileLoadingBoundary.tsx": 1,
313 - "apps/web/src/components/diffs/DiffFileTree.tsx": 3,
314 - "apps/web/src/components/diffs/useCodeViewFileReveal.ts": 1,
315 - "apps/web/src/components/diffs/useReviewFilePatches.ts": 1,
316 - "apps/web/src/components/files/AttachmentFilePreview.tsx": 3,
317 - "apps/web/src/components/files/BrowserDocumentFrame.tsx": 7,
318 - "apps/web/src/components/files/FileBrowserPanel.tsx": 9,
319 - "apps/web/src/components/files/FilePreviewPanel.tsx": 3,
320 - "apps/web/src/components/files/InlineAudioPreview.tsx": 1,
321 - "apps/web/src/components/files/useDirectoryEntries.ts": 1,
322 - "apps/web/src/components/files/useFileSaveCoordinator.ts": 2,
323 - "apps/web/src/components/guest/GuestHtmlRender.tsx": 3,
324 - "apps/web/src/components/guest/GuestPage.tsx": 7,
325 - "apps/web/src/components/media/AttachmentImage.tsx": 1,
326 - "apps/web/src/components/media/MediaVideoPlayer.tsx": 2,
327 - "apps/web/src/components/onboarding/FirstRunGate.tsx": 3,
328 - "apps/web/src/components/onboarding/WelcomeWizard.tsx": 7,
329 - "apps/web/src/components/permissions/usePermissionStatus.ts": 1,
330 - "apps/web/src/components/preview/AgentBrowserCursor.tsx": 1,
331 - "apps/web/src/components/preview/PreviewChromeRow.tsx": 1,
332 - "apps/web/src/components/preview/PreviewPanelShell.tsx": 3,
333 - "apps/web/src/components/preview/PreviewView.tsx": 7,
334 - "apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx": 3,
335 - "apps/web/src/components/preview/ZoomIndicator.tsx": 1,
336 - "apps/web/src/components/preview/useAgentOpenedPreviews.ts": 3,
337 - "apps/web/src/components/preview/usePreviewBridge.ts": 2,
338 - "apps/web/src/components/projectScriptEditor.tsx": 1,
339 - "apps/web/src/components/promptLinks/HostedPromptLinkLanding.tsx": 1,
340 - "apps/web/src/components/promptLinks/NewThreadLinkView.tsx": 2,
341 - "apps/web/src/components/promptLinks/ThreadLinkPrompt.tsx": 1,
342 - "apps/web/src/components/pullRequest/LinkPullRequestDialog.tsx": 1,
343 - "apps/web/src/components/pullRequest/PullRequestCodeTab.tsx": 5,
344 - "apps/web/src/components/pullRequest/PullRequestCommentBody.tsx": 1,
345 - "apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx": 5,
346 - "apps/web/src/components/pullRequest/PullRequestGuideTab.tsx": 2,
347 - "apps/web/src/components/pullRequest/PullRequestsColumn.tsx": 5,
348 - "apps/web/src/components/pullRequest/PullRequestsPage.tsx": 9,
349 - "apps/web/src/components/pullRequest/guide/GuideTour.tsx": 1,
350 - "apps/web/src/components/pullRequest/guide/PullRequestGuideRunCoordinator.tsx": 2,
351 - "apps/web/src/components/pullRequest/guide/useReviewGuideWriter.ts": 1,
352 - "apps/web/src/components/pullRequest/useInlineActionConfirm.ts": 1,
353 - "apps/web/src/components/pullRequest/usePullRequestDetail.ts": 1,
354 - "apps/web/src/components/pullRequest/usePullRequestFilesViewed.ts": 2,
355 - "apps/web/src/components/pullRequest/usePullRequestListView.ts": 1,
356 - "apps/web/src/components/pullRequest/useThreadLinkedPullRequest.ts": 1,
357 - "apps/web/src/components/search/ProjectContentSearchDialog.tsx": 1,
358 - "apps/web/src/components/settings/AcpRegistryIcon.tsx": 1,
359 - "apps/web/src/components/settings/AcpRegistrySearchStep.tsx": 2,
360 - "apps/web/src/components/settings/AddCodexAccountDialog.tsx": 1,
361 - "apps/web/src/components/settings/AddEnvironmentDialog.tsx": 1,
362 - "apps/web/src/components/settings/CliCommandSettingsRow.tsx": 1,
363 - "apps/web/src/components/settings/CodexSetupSection.tsx": 6,
364 - "apps/web/src/components/settings/ConnectionDiagnosisDetails.tsx": 1,
365 - "apps/web/src/components/settings/DiagnosticsSettings.tsx": 2,
366 - "apps/web/src/components/settings/EasDeviceHostsSettings.tsx": 1,
367 - "apps/web/src/components/settings/FontFamilyPicker.tsx": 2,
368 - "apps/web/src/components/settings/OpenSourceLicenses.tsx": 1,
369 - "apps/web/src/components/settings/ProjectFaviconThumbnail.tsx": 1,
370 - "apps/web/src/components/settings/ProjectIconPickerDialog.tsx": 1,
371 - "apps/web/src/components/settings/ProjectSettingsPanel.tsx": 2,
372 - "apps/web/src/components/settings/ProviderAccentColorPicker.tsx": 3,
373 - "apps/web/src/components/settings/ProviderAuthCallbackCoordinator.tsx": 1,
374 - "apps/web/src/components/settings/ProviderAuthTerminal.tsx": 2,
375 - "apps/web/src/components/settings/ProviderInstanceCard.tsx": 1,
376 - "apps/web/src/components/settings/ProviderModelsSection.tsx": 1,
377 - "apps/web/src/components/settings/ProviderSettingsForm.tsx": 1,
378 - "apps/web/src/components/settings/ResourceTelemetryDiagnostics.tsx": 2,
379 - "apps/web/src/components/settings/SavedEnvironmentRows.tsx": 1,
380 - "apps/web/src/components/settings/ScheduledTasksSettings.tsx": 2,
381 - "apps/web/src/components/settings/SettingsFontPreviews.tsx": 5,
382 - "apps/web/src/components/settings/SettingsPanels.tsx": 1,
383 - "apps/web/src/components/settings/SettingsSidebarNav.tsx": 3,
384 - "apps/web/src/components/settings/SnapShotSettings.tsx": 4,
385 - "apps/web/src/components/settings/TelemetryExportSettings.tsx": 1,
386 - "apps/web/src/components/settings/ThemeColorPicker.tsx": 1,
387 - "apps/web/src/components/settings/ThemeEditorPanel.tsx": 5,
388 - "apps/web/src/components/settings/ThemeImportDialog.tsx": 1,
389 - "apps/web/src/components/settings/ThemeSearchSection.tsx": 3,
390 - "apps/web/src/components/settings/TypographySettings.tsx": 2,
391 - "apps/web/src/components/settings/settingsLayout.tsx": 1,
392 - "apps/web/src/components/settings/useSnapShotShortcutRecorder.tsx": 1,
393 - "apps/web/src/components/sidebar/SidebarProviderUpdatePill.tsx": 2,
394 - "apps/web/src/components/sidebar/SidebarThreadRow.tsx": 5,
395 - "apps/web/src/components/sidebar/SidebarThreadUndoNotice.tsx": 1,
396 - "apps/web/src/components/sidebar/SidebarUpdatePill.tsx": 1,
397 - "apps/web/src/components/sidebar/mainAppLocation.ts": 1,
398 - "apps/web/src/components/sidebar/updateEverythingRun.tsx": 2,
399 - "apps/web/src/components/ui/middle-truncate.tsx": 1,
400 - "apps/web/src/components/ui/sidebar.tsx": 3,
401 - "apps/web/src/components/ui/toast.tsx": 2,
402 - "apps/web/src/components/ui/tooltip.tsx": 1,
403 - "apps/web/src/components/usage/UsageLimits.tsx": 1,
404 - "apps/web/src/components/usage/UsageLimitsPooled.tsx": 1,
405 - "apps/web/src/components/usage/UsagePage.tsx": 3,
406 - "apps/web/src/components/usage/UsageProviderChart.tsx": 1,
407 - "apps/web/src/connection/useDesktopLocalBootstraps.ts": 1,
408 - "apps/web/src/hooks/FileMetadataThreadProvider.tsx": 1,
409 - "apps/web/src/hooks/useCopyToClipboard.ts": 1,
410 - "apps/web/src/hooks/useDefaultTheme.ts": 1,
411 - "apps/web/src/hooks/useDelayedStatus.ts": 2,
412 - "apps/web/src/hooks/useEnvironmentDisconnectDelay.ts": 1,
413 - "apps/web/src/hooks/useEnvironmentTheme.ts": 1,
414 - "apps/web/src/hooks/useLiveRefresh.ts": 1,
415 - "apps/web/src/hooks/useLiveRegion.ts": 1,
416 - "apps/web/src/hooks/useNavigateBack.ts": 1,
417 - "apps/web/src/hooks/usePreviewPanelInlineSize.ts": 1,
418 - "apps/web/src/hooks/useProactivePanels.ts": 1,
419 - "apps/web/src/hooks/useResizableWidth.ts": 2,
420 - "apps/web/src/hooks/useResizeDrag.ts": 2,
421 - "apps/web/src/hooks/useSettings.ts": 1,
422 - "apps/web/src/hooks/useStableCallback.ts": 1,
423 - "apps/web/src/hooks/useTheme.ts": 1,
424 - "apps/web/src/hooks/useThreadVisitedMigration.ts": 1,
425 - "apps/web/src/hooks/useWorkspaceMutationRefresh.ts": 1,
426 - "apps/web/src/panelAnimations.ts": 2,
427 - "apps/web/src/remoteOpen.ts": 1,
428 - "apps/web/src/routes/__root.tsx": 14,
429 - "apps/web/src/routes/_chat.index.tsx": 1,
430 - "apps/web/src/routes/_chat.tsx": 1,
431 - "apps/web/src/shortcutModifierState.ts": 1,
432 - "apps/web/src/state/olderSettledShelf.ts": 2,
433 - "apps/web/src/state/pullRequests.ts": 2,
434 - "apps/web/src/state/queries.ts": 2,
435 - "apps/web/src/state/threads.ts": 1
436 -}
vite.config.ts
+1 -1
@@ -593,7 +593,7 @@ export default defineConfig({
593 },
594 {
595 files: ["apps/web/src/**", "apps/mobile/src/**", "packages/*/src/**"],
596 - rules: { "t3code/react-effect-budget": "error" },
596 + rules: { "t3code/no-unreasoned-state-sync": "error" },
597 },
598 {
599 // React Compiler caches use* functions only if they call a hook.