Skip to content
TypeScript

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

Julius Marminge33d0c9637bfd
diff --git a/AGENTS.md b/AGENTS.md
index 1dbd367a6c1..f990c3d36b7 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -199,7 +199,7 @@ Architecture and its constraints: `docs/internals/overview.md`. Glossary: `docs/
options, and pass combinators as additional function-builder arguments.
- Inferred types over annotations. `any` is the enemy.
- 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.
-- 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>`.
+- 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>`.
- 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.
- If a rule here fights the task in front of you, say so loudly and get a human sign-off before breaking it.
diff --git a/apps/mobile/src/App.tsx b/apps/mobile/src/App.tsx
index 13fd2a7f437..5798c1adb06 100644
--- a/apps/mobile/src/App.tsx
+++ b/apps/mobile/src/App.tsx
@@ -195,6 +195,7 @@ disposeOnFoundationReplace(typeof module === "undefined" ? undefined : module.ho
function SplashScreenCoordinator() {
const { isReady } = useAppearancePreferences();
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- hides the native splash screen once appearance preferences have loaded
useEffect(() => {
if (isReady) void SplashScreen.hide();
}, [isReady]);
diff --git a/apps/mobile/src/components/ComposerEditor.tsx b/apps/mobile/src/components/ComposerEditor.tsx
index 0098605414b..c96e872fd69 100644
--- a/apps/mobile/src/components/ComposerEditor.tsx
+++ b/apps/mobile/src/components/ComposerEditor.tsx
@@ -61,6 +61,7 @@ export function ComposerEditor({
? preferencesResult.value.composerEnterBehavior
: undefined;
const contextHistory = createComposerDraftContextHistory();
+ // 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
useEffect(() => () => contextHistory.dispose(), [contextHistory]);
const changeText = (text: string) => {
const restored = contextHistory.restore(
diff --git a/apps/mobile/src/components/FilePreview.ios.tsx b/apps/mobile/src/components/FilePreview.ios.tsx
index ed5c6e56ee8..45f09779f13 100644
--- a/apps/mobile/src/components/FilePreview.ios.tsx
+++ b/apps/mobile/src/components/FilePreview.ios.tsx
@@ -34,6 +34,7 @@ function NativeFilePreview(props: {
else Dialog.alert("Could not open preview", "The file could not be loaded. Please try again.");
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- presents the native file preview and dismisses it on cleanup
useEffect(() => {
let canceled = false;
const presentation =
diff --git a/apps/mobile/src/components/FilePreview.tsx b/apps/mobile/src/components/FilePreview.tsx
index b0cf1fc5c3a..486cd9e236b 100644
--- a/apps/mobile/src/components/FilePreview.tsx
+++ b/apps/mobile/src/components/FilePreview.tsx
@@ -55,6 +55,7 @@ function DocumentPreview(props: {
"A compatible viewer must be installed. Check your connection and try again.",
);
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens the attachment in an external viewer and aborts the open on cleanup
useEffect(() => {
const controller = new AbortController();
const input = {
diff --git a/apps/mobile/src/components/FilePreviewModal.tsx b/apps/mobile/src/components/FilePreviewModal.tsx
index 8079379fd48..849bacd8ac4 100644
--- a/apps/mobile/src/components/FilePreviewModal.tsx
+++ b/apps/mobile/src/components/FilePreviewModal.tsx
@@ -86,6 +86,7 @@ function ResolvedFilePreview(props: {
props.onRequestClose();
});
// Resolves once per presentation and holds local file leases until it closes.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- resolves preview files and holds their local file leases until the preview closes
useEffect(() => {
if (items.every((item) => "uri" in item)) return;
const controller = new AbortController();
diff --git a/apps/mobile/src/components/MediaVideoPlayer.tsx b/apps/mobile/src/components/MediaVideoPlayer.tsx
index ea39cac15ba..12d31986710 100644
--- a/apps/mobile/src/components/MediaVideoPlayer.tsx
+++ b/apps/mobile/src/components/MediaVideoPlayer.tsx
@@ -33,6 +33,7 @@ function LoadedMediaVideo(props: {
useMediaVideoPlayback(player, props, playback);
const previousPlaybackRequested = useRef(false);
const onPlaybackStart = useEffectEvent(() => props.onPlaybackStart?.());
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to native video player events to keep the shared audio session in step
useEffect(() => {
const subscription = player.addListener("playingChange", ({ isPlaying }) => {
if (isPlaying && !active.current && !fullscreen.current) playback.pause();
@@ -74,6 +75,7 @@ function LoadedMediaVideo(props: {
if (!signal.aborted && props.playRequested) await playIfUninterrupted();
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- loads the video source into the native player and aborts the load on cleanup
useEffect(() => {
const controller = new AbortController();
// oxlint-disable-next-line react/set-state-in-effect -- Starting a native media load publishes pending before its async result.
diff --git a/apps/mobile/src/components/ProjectFavicon.tsx b/apps/mobile/src/components/ProjectFavicon.tsx
index b450e1d2935..85f5bbd55c6 100644
--- a/apps/mobile/src/components/ProjectFavicon.tsx
+++ b/apps/mobile/src/components/ProjectFavicon.tsx
@@ -165,6 +165,7 @@ function ProjectFaviconImage(props: {
);
// Registers with the module-level loader before the Image's native onLoad/onError can fire,
// so stale loads for a superseded URL under the same cacheKey are ignored.
+ // 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
useLayoutEffect(() => {
if (faviconRequest === null) return;
return beginProjectFaviconRequest(faviconRequest);
diff --git a/apps/mobile/src/components/VideoPreviewModal.ios.tsx b/apps/mobile/src/components/VideoPreviewModal.ios.tsx
index 5479e1be521..233cb063c42 100644
--- a/apps/mobile/src/components/VideoPreviewModal.ios.tsx
+++ b/apps/mobile/src/components/VideoPreviewModal.ios.tsx
@@ -65,6 +65,7 @@ function NativeVideoPreview(props: {
}
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- presents the native fullscreen video and owns its audio session and file lease until cleanup
useEffect(() => {
const controller = new AbortController();
let token: ReturnType<typeof acquireAudioSession> | null = null;
diff --git a/apps/mobile/src/components/ui/Notice.tsx b/apps/mobile/src/components/ui/Notice.tsx
index 44ca6c8cf7f..90a31f70543 100644
--- a/apps/mobile/src/components/ui/Notice.tsx
+++ b/apps/mobile/src/components/ui/Notice.tsx
@@ -16,6 +16,7 @@ export function Notice(props: {
readonly dismissLabel?: string;
}) {
const danger = props.tone === "danger";
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- announces the message to VoiceOver through AccessibilityInfo
useEffect(() => {
// Live regions reach TalkBack; VoiceOver needs an explicit announcement.
if (Platform.OS === "ios") AccessibilityInfo.announceForAccessibility(props.message);
diff --git a/apps/mobile/src/components/ui/OverlayPortal.tsx b/apps/mobile/src/components/ui/OverlayPortal.tsx
index a4f07f46024..b5cd51e6c90 100644
--- a/apps/mobile/src/components/ui/OverlayPortal.tsx
+++ b/apps/mobile/src/components/ui/OverlayPortal.tsx
@@ -38,6 +38,7 @@ export function OverlayPortal(props: { readonly children: ReactNode }) {
// happen after commit. No dependency array: re-project after every render so
// the host always shows the current content (menus re-render while open —
// drill-in, theme).
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- projects children into the out-of-tree overlay host store after every commit
useEffect(() => {
entries.set(key, props.children);
emit();
@@ -45,6 +46,7 @@ export function OverlayPortal(props: { readonly children: ReactNode }) {
// Removal is unmount-only: deleting on every re-projection would move the
// entry to the end of the map and restack it above overlays opened later.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- removes this entry from the overlay host store on unmount
useEffect(
() => () => {
entries.delete(key);
diff --git a/apps/mobile/src/components/ui/Toast.tsx b/apps/mobile/src/components/ui/Toast.tsx
index 4426cee5552..7610a815195 100644
--- a/apps/mobile/src/components/ui/Toast.tsx
+++ b/apps/mobile/src/components/ui/Toast.tsx
@@ -55,6 +55,7 @@ function ToastContent(props: ToastProps & { readonly glassReady?: boolean }) {
const action = props.action ? (
<Button label={props.action.label} onPress={props.action.onPress} />
) : null;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- announces the toast message to VoiceOver through AccessibilityInfo
useEffect(() => {
if (Platform.OS === "ios") AccessibilityInfo.announceForAccessibility(props.message);
}, [props.message]);
@@ -149,6 +150,7 @@ function SwipeableToast(props: ToastProps & { readonly onDismiss: () => void })
const { onDismiss } = props;
const translation = useSharedValue(0);
const width = useSharedValue(0);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the Reanimated swipe translation animation on unmount
useLayoutEffect(
() => () => {
cancelAnimation(translation);
diff --git a/apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx b/apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx
index 3ec1b2b9a56..a861a6015fb 100644
--- a/apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx
+++ b/apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx
@@ -95,6 +95,7 @@ function BrowserPreviewScreen({
setPictureInPicture(NO_PICTURE_IN_PICTURE);
setSelectedTabId(tabId);
}
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- closes the focused route through the navigator once the thread has no browser tabs left
useEffect(() => {
if (focused && loaded && tabs.length === 0) onClose();
}, [focused, loaded, tabs.length, onClose]);
diff --git a/apps/mobile/src/features/browser/PreviewStreamWebView.tsx b/apps/mobile/src/features/browser/PreviewStreamWebView.tsx
index 4440ed712fb..bf072979166 100644
--- a/apps/mobile/src/features/browser/PreviewStreamWebView.tsx
+++ b/apps/mobile/src/features/browser/PreviewStreamWebView.tsx
@@ -295,6 +295,7 @@ function PreviewStreamDocumentView({
onControl?.(null);
});
// The stream lives exactly as long as this view.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- starts the bootstrap timeout and stops the WebView stream when this view unmounts
useLayoutEffect(() => {
active.current = true;
const view = webView.current;
diff --git a/apps/mobile/src/features/devices/DevicePreviewRouteScreen.tsx b/apps/mobile/src/features/devices/DevicePreviewRouteScreen.tsx
index d5c633793a9..65aaee6f0d4 100644
--- a/apps/mobile/src/features/devices/DevicePreviewRouteScreen.tsx
+++ b/apps/mobile/src/features/devices/DevicePreviewRouteScreen.tsx
@@ -58,6 +58,7 @@ export function DevicePreviewRouteScreen({ route }: DevicePreviewRouteScreenProp
const onClose = () => navigation.goBack();
const { environmentId, threadId } = route.params;
const isBlankLink = environmentId.trim().length === 0 || threadId.trim().length === 0;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pops a deep-linked route with a blank environment or thread off the navigator
useEffect(() => {
if (isBlankLink) onClose();
}, [isBlankLink, onClose]);
@@ -107,9 +108,11 @@ export function DevicePreviewScreen({
setInputConnected(connected);
if (connected && !embedded) setControlsVisible(false);
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- closes the focused route through the navigator once the thread has no device previews
useEffect(() => {
if (focused && state.data !== null && previews.length === 0) onClose();
}, [focused, state.data, previews.length, onClose]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to the Accelerometer while focused to toggle controls on a shake
useEffect(() => {
if (!focused || !foreground || embedded) return;
const shaken = createShakeDetector();
diff --git a/apps/mobile/src/features/devices/DeviceStreamWebView.tsx b/apps/mobile/src/features/devices/DeviceStreamWebView.tsx
index 62e42d22418..798e650b73e 100644
--- a/apps/mobile/src/features/devices/DeviceStreamWebView.tsx
+++ b/apps/mobile/src/features/devices/DeviceStreamWebView.tsx
@@ -118,6 +118,7 @@ function DeviceStreamDocumentView({
);
const resetInput = useEffectEvent(() => void onInputConnected(false));
// The stream lives exactly as long as this view.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- starts the bootstrap timeout and stops the WebView device stream when this view unmounts
useLayoutEffect(() => {
active.current = true;
resetInput();
diff --git a/apps/mobile/src/features/diffs/nativeReviewDiffSurface.ts b/apps/mobile/src/features/diffs/nativeReviewDiffSurface.ts
index b82570c11a7..a21dd973577 100644
--- a/apps/mobile/src/features/diffs/nativeReviewDiffSurface.ts
+++ b/apps/mobile/src/features/diffs/nativeReviewDiffSurface.ts
@@ -200,6 +200,7 @@ function useNativeReviewDiffPayload(
onFailure?: () => void,
onDelivered?: (payload: string) => void,
) {
+ // 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
useEffect(() => {
if (payload === undefined) {
return;
@@ -330,10 +331,12 @@ function NativeReviewDiffContent(
);
useNativeReviewDiffPayload(nativeRef, "setTokensJson", tokensJson);
const onDebugRef = useRef(onDebug);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- keeps the latest onDebug for callbacks the native diff view fires outside render
useEffect(() => {
onDebugRef.current = onDebug;
}, [onDebug]);
const reportedMountRef = useRef(false);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reports the native surface mount to the debug callback once per mount
useEffect(() => {
// Effect replay keeps the same native content; only a new mount loses tokens.
if (reportedMountRef.current) return;
diff --git a/apps/mobile/src/features/files/AudioFilePreview.tsx b/apps/mobile/src/features/files/AudioFilePreview.tsx
index f9c92a5e201..ea042ab7da1 100644
--- a/apps/mobile/src/features/files/AudioFilePreview.tsx
+++ b/apps/mobile/src/features/files/AudioFilePreview.tsx
@@ -24,10 +24,12 @@ export function AudioFilePreview(props: { uri: string; onRetry: () => void }) {
// Video teardown deactivates the shared iOS session, which would stop this player.
useMediaAudioSessionHold(status.playing);
const fullscreenVideoOpen = useFullscreenVideoOpen();
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- keeps the shared audio session in step with the native player status and fullscreen video
useEffect(() => {
if (fullscreenVideoOpen || status.didJustFinish || status.error) playback.pause();
else playback.playingChanged(status.playing);
}, [fullscreenVideoOpen, status.didJustFinish, status.error, status.playing, playback]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to AppState to pause playback in the background, and pauses on cleanup
useEffect(() => {
const subscription = AppState.addEventListener("change", (state) => {
if (state !== "active") playback.pause();
diff --git a/apps/mobile/src/features/files/FileTreeBrowser.tsx b/apps/mobile/src/features/files/FileTreeBrowser.tsx
index 93e238822c4..e041fa5212f 100644
--- a/apps/mobile/src/features/files/FileTreeBrowser.tsx
+++ b/apps/mobile/src/features/files/FileTreeBrowser.tsx
@@ -146,10 +146,12 @@ export function FileTreeBrowser(props: {
});
const { revealSelection } = props;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- expands the controlled selection's ancestor directories in the file tree state
useEffect(() => {
revealSelection(controlledSelectedPath);
}, [controlledSelectedPath, revealSelection]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- requests listings for expanded directories that are not yet loaded or pending
useEffect(() => {
const visit = (nodes: ReadonlyArray<FileTreeNode>) => {
for (const node of nodes) {
@@ -161,6 +163,7 @@ export function FileTreeBrowser(props: {
visit(tree);
}, [tree, expandedPaths, onLoadDirectory]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the pending selection timer on unmount
useEffect(
() => () => {
if (pendingSelectionTimeoutRef.current !== null) {
diff --git a/apps/mobile/src/features/files/SourceFileSurface.tsx b/apps/mobile/src/features/files/SourceFileSurface.tsx
index bf691fa4bef..d78a45fc75f 100644
--- a/apps/mobile/src/features/files/SourceFileSurface.tsx
+++ b/apps/mobile/src/features/files/SourceFileSurface.tsx
@@ -249,6 +249,7 @@ function JavaScriptSourceFileSurface(props: SourceFileSurfaceProps) {
) : undefined;
// Layout effect so a pending jump is cancelled in the commit that swaps the file.
+ // 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
useLayoutEffect(() => {
if (targetIndex === null) {
return;
diff --git a/apps/mobile/src/features/files/ZipArchiveView.tsx b/apps/mobile/src/features/files/ZipArchiveView.tsx
index 537b9c736f6..bb9931d4e3c 100644
--- a/apps/mobile/src/features/files/ZipArchiveView.tsx
+++ b/apps/mobile/src/features/files/ZipArchiveView.tsx
@@ -178,7 +178,7 @@ function useZipArchive(input: {
const { uri, isLocal, sizeBytes } = input;
// The parent mints a new refresh callback on every render; it must not reload the archive.
const refresh = useEffectEvent(input.refresh);
- // oxlint-disable-next-line t3code/react-effect-budget -- Load archive bytes and cancel the stream on cleanup.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Load archive bytes and cancel the stream on cleanup.
useEffect(() => {
if (!uri) return;
const abort = new AbortController();
@@ -652,9 +652,9 @@ function ZipEntryView(props: {
const [busy, setBusy] = useState<"save" | "attach" | null>(null);
const action = useRef<AbortController | null>(null);
const pendingViewerError = useRef<string | null>(null);
- // oxlint-disable-next-line t3code/react-effect-budget -- Cancel a pending save or attach when the entry closes.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Cancel a pending save or attach when the entry closes.
useEffect(() => () => action.current?.abort(), []);
- // oxlint-disable-next-line t3code/react-effect-budget -- Write the selected entry to a cached file and release it on cleanup.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Write the selected entry to a cached file and release it on cleanup.
useEffect(() => {
if (tooBig) return;
const controller = new AbortController();
diff --git a/apps/mobile/src/features/files/useFileTreeEntries.ts b/apps/mobile/src/features/files/useFileTreeEntries.ts
index 1734cb705a7..c6fb20a0c91 100644
--- a/apps/mobile/src/features/files/useFileTreeEntries.ts
+++ b/apps/mobile/src/features/files/useFileTreeEntries.ts
@@ -180,6 +180,7 @@ export function useFileTreeEntries(input: {
const { target } = directories;
const requestsByTarget = useRef(new WeakMap<object, ReturnType<typeof createRequests>>());
// Cancel the old target before consumers' passive effects start new directory loads.
+ // 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
useLayoutEffect(() => {
const requests = getRequests(requestsByTarget.current, target);
requests.active = true;
diff --git a/apps/mobile/src/features/home/HomeScreen.tsx b/apps/mobile/src/features/home/HomeScreen.tsx
index 37de121c31f..5c7b2e9858f 100644
--- a/apps/mobile/src/features/home/HomeScreen.tsx
+++ b/apps/mobile/src/features/home/HomeScreen.tsx
@@ -316,6 +316,7 @@ export function HomeScreen(props: HomeScreenProps) {
const listRef = useRef<LegendListRef>(null);
const searchMode = workspace?.state.tabs.threads.searchMode;
const restoredOffset = workspace?.state.tabs.threads.scrollOffset;
+ // 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
useEffect(() => {
if (searchMode !== "resting" || restoredOffset === undefined) return;
listRef.current?.scrollToOffset({
@@ -333,6 +334,7 @@ export function HomeScreen(props: HomeScreenProps) {
};
// Status-bar, accessibility and programmatic scrolls bypass the gate; activate visible rows after settling.
const activationTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the row activation timer on unmount
useEffect(() => () => clearTimeout(activationTimerRef.current), []);
const handleListScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {
onFabScroll?.(event);
@@ -481,6 +483,7 @@ export function HomeScreen(props: HomeScreenProps) {
onSelectThread(thread);
};
useThreadJumpShortcuts(threadListV2Items, selectThread);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reads the list's visible range after commit to enable swipe gestures on those rows
useEffect(() => {
if (swipeEnabled) activateVisibleRows(threadListV2Items);
}, [activateVisibleRows, swipeEnabled, threadListV2Items]);
diff --git a/apps/mobile/src/features/home/ThreadListToolbar.tsx b/apps/mobile/src/features/home/ThreadListToolbar.tsx
index 90decba1d5b..1a1c4297d76 100644
--- a/apps/mobile/src/features/home/ThreadListToolbar.tsx
+++ b/apps/mobile/src/features/home/ThreadListToolbar.tsx
@@ -56,6 +56,7 @@ export function ThreadListToolbar(props: {
Keyboard.dismiss();
}, [onSearchQueryChange]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to BackHandler while searching to close search on Android back
useEffect(() => {
if (!searching || !listFocused) return;
const subscription = BackHandler.addEventListener("hardwareBackPress", () => {
diff --git a/apps/mobile/src/features/home/WorkspaceConnectionTitle.tsx b/apps/mobile/src/features/home/WorkspaceConnectionTitle.tsx
index d0963c1b9b8..58cf4138483 100644
--- a/apps/mobile/src/features/home/WorkspaceConnectionTitle.tsx
+++ b/apps/mobile/src/features/home/WorkspaceConnectionTitle.tsx
@@ -68,6 +68,7 @@ function StatusFadeIn(props: {
}) {
const { animate } = props;
const [opacity] = useState(() => new Animated.Value(0));
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- runs the Animated opacity fade-in and stops it on cleanup
useEffect(() => {
if (!animate) return;
const animation = Animated.timing(opacity, {
diff --git a/apps/mobile/src/features/home/thread-swipe-actions.tsx b/apps/mobile/src/features/home/thread-swipe-actions.tsx
index 0ad078f73b5..f3e40419d05 100644
--- a/apps/mobile/src/features/home/thread-swipe-actions.tsx
+++ b/apps/mobile/src/features/home/thread-swipe-actions.tsx
@@ -164,6 +164,7 @@ export function useSwipeableScrollGate(options?: {
settleTimerRef.current = null;
}
}, []);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the scroll settle timer on unmount
useEffect(() => clearSettle, [clearSettle]);
const onScrollBeginDrag = useCallback(
@@ -289,6 +290,7 @@ export function ThreadSwipeable(props: ThreadSwipeableProps) {
pending.resolve();
}, []);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the row's Reanimated animations and settles a pending dismissal on unmount
useLayoutEffect(() => {
mountedRef.current = true;
return () => {
@@ -302,6 +304,7 @@ export function ThreadSwipeable(props: ThreadSwipeableProps) {
}, [actionOpacity, collapse, fallbackTranslation, finishDismiss]);
// Reset recycled rows in place so their child views stay mounted.
+ // 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
useLayoutEffect(() => {
if (contentRef.current === content) return;
contentRef.current = content;
@@ -309,6 +312,7 @@ export function ThreadSwipeable(props: ThreadSwipeableProps) {
restoreRow();
}, [content, finishDismiss, restoreRow]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- closes the open swipeable and resets its shared values when the row goes dormant
useLayoutEffect(() => {
if (props.dormant && activeTranslationRef.current && dismissalRef.current === null) {
restoreRow();
@@ -339,6 +343,7 @@ export function ThreadSwipeable(props: ThreadSwipeableProps) {
},
[actionOpacity, collapse, dismissing, finishDismiss, rowWidth],
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- registers this row's animated dismissal in the module-level thread dismissal registry
useLayoutEffect(
() =>
props.dormant
diff --git a/apps/mobile/src/features/keyboard/CommandPalette.tsx b/apps/mobile/src/features/keyboard/CommandPalette.tsx
index 7e7fea4527b..b900108065c 100644
--- a/apps/mobile/src/features/keyboard/CommandPalette.tsx
+++ b/apps/mobile/src/features/keyboard/CommandPalette.tsx
@@ -507,6 +507,7 @@ export function CommandPalette(props: {
// The native list follows the highlighted row. Key presses move it, but so do
// live thread updates and late message matches that reorder or drop the
// selected row under a kept selection, so no single handler owns the scroll.
+ // 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
useEffect(() => {
if (selectedIndex === 0) {
// Centering before the list measures its height scrolls half the first row out of view.
@@ -527,6 +528,7 @@ export function CommandPalette(props: {
props.onClose();
pendingAction.current?.();
}, [props]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the dismiss fallback timer on unmount
useEffect(
() => () => {
if (dismissFallback.current !== null) clearTimeout(dismissFallback.current);
diff --git a/apps/mobile/src/features/keyboard/HardwareKeyboardCommandProvider.tsx b/apps/mobile/src/features/keyboard/HardwareKeyboardCommandProvider.tsx
index 7b62a6af94c..8cd9e215e0f 100644
--- a/apps/mobile/src/features/keyboard/HardwareKeyboardCommandProvider.tsx
+++ b/apps/mobile/src/features/keyboard/HardwareKeyboardCommandProvider.tsx
@@ -89,6 +89,7 @@ export function HardwareKeyboardCommandProvider({
setCopyFeedback(EMPTY_COPY_FEEDBACK);
}, COPY_FEEDBACK_DISMISS_MS);
}, []);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the copy feedback timer on unmount
useEffect(
() => () => {
if (copyFeedbackTimerRef.current !== null) {
diff --git a/apps/mobile/src/features/keyboard/hardwareKeyboardCommands.ts b/apps/mobile/src/features/keyboard/hardwareKeyboardCommands.ts
index cabe2949788..3525e178280 100644
--- a/apps/mobile/src/features/keyboard/hardwareKeyboardCommands.ts
+++ b/apps/mobile/src/features/keyboard/hardwareKeyboardCommands.ts
@@ -27,6 +27,7 @@ export function useHardwareKeyboardCommand(
command: HardwareKeyboardCommand | ReadonlyArray<HardwareKeyboardCommand>,
handler: CommandHandler,
): void {
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- registers the handler in the module-level hardware keyboard command registry
useEffect(() => {
const commands = typeof command === "string" ? [command] : command;
for (const command of commands) {
diff --git a/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx b/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
index 53d2fb3e1d7..a2f880ba724 100644
--- a/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
+++ b/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
@@ -719,6 +719,7 @@ function AdaptiveWorkspaceLayoutContent(
);
const renderedRailWidth = useSharedValue(navigationRailWidth);
const leavingWorkspacePage = useRef(false);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- animates the Reanimated rail and sidebar width shared values toward the layout's targets
useEffect(() => {
if (nativeWorkspace) return;
renderedRailWidth.set(withTiming(navigationRailWidth, WORKSPACE_PANE_TIMING));
diff --git a/apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx b/apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx
index 0b2efd9de24..2b7677929dc 100644
--- a/apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx
+++ b/apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx
@@ -303,6 +303,7 @@ function WorkspaceColumns(
if (transition.pop) props.navigation.dispatch(transition.pop);
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- tells the native split host which column to show while collapsed
useEffect(() => {
if (layout.usesSplitView || collapsedColumn.current.visible === compactColumn) return;
collapsedColumn.current = { ...collapsedColumn.current, visible: compactColumn };
diff --git a/apps/mobile/src/features/layout/workspace-inspector-pane.tsx b/apps/mobile/src/features/layout/workspace-inspector-pane.tsx
index 68a57a22980..4c003008d1d 100644
--- a/apps/mobile/src/features/layout/workspace-inspector-pane.tsx
+++ b/apps/mobile/src/features/layout/workspace-inspector-pane.tsx
@@ -40,6 +40,7 @@ export function WorkspaceInspectorPane(props: {
const reduceMotion = useReducedMotion();
const onClosed = props.onClosed;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- animates the Reanimated inspector progress and width shared values when visibility or width changes
useEffect(() => {
inspectorProgress.set(
withTiming(inspectorVisible ? 1 : 0, WORKSPACE_PANE_TIMING, (finished) => {
diff --git a/apps/mobile/src/features/projects/AddProjectScreen.tsx b/apps/mobile/src/features/projects/AddProjectScreen.tsx
index b03797cf358..37701e954fb 100644
--- a/apps/mobile/src/features/projects/AddProjectScreen.tsx
+++ b/apps/mobile/src/features/projects/AddProjectScreen.tsx
@@ -366,6 +366,7 @@ function useBrowsePathInput(environment: EnvironmentOption | null, pinnedDirecto
return committed;
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- invalidates the browse navigation coordinator on unmount so in-flight browses do not commit
useEffect(
() => () => {
browseNavigation.invalidate();
diff --git a/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx b/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
index 5463542d24c..164b1dc965c 100644
--- a/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
+++ b/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
@@ -1020,6 +1020,7 @@ function PullRequestFileRouteContent({ route }: PullRequestFileRouteProps) {
});
// Subscribed for the whole screen, so a pick made while the diff is still loading is kept for
// the first draw.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to pull request file jump requests for the screen's lifetime
useEffect(() => subscribePullRequestFileJump(jumpScope, (path) => jumpToFile(path)), [jumpScope]);
const { nativeReviewDiffStyle } = useAppearanceCodeSurface();
const { themeAppearance, appearance, setCodeWordBreak } = useAppearancePreferences();
@@ -1034,6 +1035,7 @@ function PullRequestFileRouteContent({ route }: PullRequestFileRouteProps) {
canHighlight: true,
});
const [NativeDiffView] = useState(() => resolveNativeReviewDiffView());
+ // 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
useEffect(() => {
if (!targetFile) loadMore();
}, [targetFile, loadMore]);
diff --git a/apps/mobile/src/features/pull-requests/PullRequestToolbar.android.tsx b/apps/mobile/src/features/pull-requests/PullRequestToolbar.android.tsx
index c6cb7e2bea7..1bb030cef8e 100644
--- a/apps/mobile/src/features/pull-requests/PullRequestToolbar.android.tsx
+++ b/apps/mobile/src/features/pull-requests/PullRequestToolbar.android.tsx
@@ -41,6 +41,7 @@ export function PullRequestToolbar(props: {
recordScrollOffset("pullRequests", tab.searchEntryOffset);
dispatch({ type: "cancel", tab: "pullRequests" });
}, [dispatch, recordScrollOffset, tab.searchEntryOffset]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to BackHandler while searching to close the PR search on Android back
useEffect(() => {
if (!searching) return;
const subscription = BackHandler.addEventListener("hardwareBackPress", () => {
diff --git a/apps/mobile/src/features/pull-requests/PullRequestsScreen.tsx b/apps/mobile/src/features/pull-requests/PullRequestsScreen.tsx
index e3780009cbe..b8347d7b080 100644
--- a/apps/mobile/src/features/pull-requests/PullRequestsScreen.tsx
+++ b/apps/mobile/src/features/pull-requests/PullRequestsScreen.tsx
@@ -108,6 +108,7 @@ export function PullRequestsScreen(
// toolbar that cancels has no handle on this list, so the list scrolls itself
// once it sees the tab come back to resting.
const previousSearchMode = useRef(tab.searchMode);
+ // 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
useEffect(() => {
const restoringSearch =
previousSearchMode.current !== "resting" && tab.searchMode === "resting";
diff --git a/apps/mobile/src/features/pull-requests/guide/PullRequestGuideScreen.tsx b/apps/mobile/src/features/pull-requests/guide/PullRequestGuideScreen.tsx
index fe5247b51d4..d198ea5b09e 100644
--- a/apps/mobile/src/features/pull-requests/guide/PullRequestGuideScreen.tsx
+++ b/apps/mobile/src/features/pull-requests/guide/PullRequestGuideScreen.tsx
@@ -113,6 +113,7 @@ export function PullRequestGuideStopScreen({ route }: StaticScreenProps<GuideSto
);
const missing = wanted.some((path) => !loadedPaths.has(path));
const { error: diffError, loadMore } = diff;
+ // 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
useEffect(() => {
if (state.enabled && missing && !diffError) loadMore();
}, [state.enabled, missing, diffError, loadMore]);
diff --git a/apps/mobile/src/features/pull-requests/usePullRequestDiff.ts b/apps/mobile/src/features/pull-requests/usePullRequestDiff.ts
index c3c25b85919..753709e2049 100644
--- a/apps/mobile/src/features/pull-requests/usePullRequestDiff.ts
+++ b/apps/mobile/src/features/pull-requests/usePullRequestDiff.ts
@@ -44,6 +44,7 @@ export function usePullRequestDiffEntry(navigation: {
) => () => void;
}) {
const [ready, setReady] = useState(false);
+ // 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
useLayoutEffect(() => {
if (ready) return;
let opening = false;
diff --git a/apps/mobile/src/features/pull-requests/usePullRequestEnvironmentFallback.ts b/apps/mobile/src/features/pull-requests/usePullRequestEnvironmentFallback.ts
index 11a3e667fb3..a48e1a09656 100644
--- a/apps/mobile/src/features/pull-requests/usePullRequestEnvironmentFallback.ts
+++ b/apps/mobile/src/features/pull-requests/usePullRequestEnvironmentFallback.ts
@@ -17,6 +17,7 @@ export function usePullRequestEnvironmentFallback(params: PullRequestEnvironment
() => (isReady ? pullRequestFallbackEnvironment(params, projects, environments) : null),
[params, projects, environments, isReady],
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- rewrites the route params through the navigator to the fallback environment once connections are ready
useEffect(() => {
if (fallback) navigation.setParams(fallback);
}, [fallback, navigation]);
diff --git a/apps/mobile/src/features/pull-requests/usePullRequestReviewDraft.ts b/apps/mobile/src/features/pull-requests/usePullRequestReviewDraft.ts
index 008031f7ebd..0de1ae5c638 100644
--- a/apps/mobile/src/features/pull-requests/usePullRequestReviewDraft.ts
+++ b/apps/mobile/src/features/pull-requests/usePullRequestReviewDraft.ts
@@ -75,6 +75,7 @@ async function persist() {
export function usePullRequestReviewDraft(params: PullRequestParams) {
const snapshot = useAtomValue(state);
const key = pullRequestReviewKey(params);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- loads review drafts from disk and persists them when AppState leaves active and on unmount
useEffect(() => {
void load();
const listener = AppState.addEventListener("change", (phase) => {
diff --git a/apps/mobile/src/features/review/useNativeReviewDiffHighlighting.ts b/apps/mobile/src/features/review/useNativeReviewDiffHighlighting.ts
index b398867ea2d..1e263e50397 100644
--- a/apps/mobile/src/features/review/useNativeReviewDiffHighlighting.ts
+++ b/apps/mobile/src/features/review/useNativeReviewDiffHighlighting.ts
@@ -50,6 +50,7 @@ export function useNativeReviewDiffHighlighting(input: {
// Effect on purpose: the native highlighter's token stream and the scheduler's timers must
// reset with the diff the view shows, and be cancelled when it unmounts.
+ // 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
useEffect(() => {
traceDiffHighlight("viewport-reset", {
reset: diffHighlightTraceId(resetKey),
@@ -69,6 +70,7 @@ export function useNativeReviewDiffHighlighting(input: {
}, [enabled, resetKey, rows.length, scheduler, viewportScope]);
// Effect on purpose: abortable async highlighting tied to the visible range's lifetime.
+ // 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
useEffect(() => {
if (!enabled || rows.length === 0 || !viewport.range || viewport.scope !== viewportScope) {
return;
diff --git a/apps/mobile/src/features/review/useReviewDiffData.ts b/apps/mobile/src/features/review/useReviewDiffData.ts
index 21cec36eca5..fcad725b13f 100644
--- a/apps/mobile/src/features/review/useReviewDiffData.ts
+++ b/apps/mobile/src/features/review/useReviewDiffData.ts
@@ -262,6 +262,7 @@ export function useReviewDiffData(input: {
[draftMessage],
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- records review perf marks and diagnostic logs once a parsed diff has committed
useEffect(() => {
if (parsedDiff.kind !== "files") {
return;
diff --git a/apps/mobile/src/features/review/useReviewDiffPrewarming.ts b/apps/mobile/src/features/review/useReviewDiffPrewarming.ts
index 66a7c636d65..9d1b2a6819d 100644
--- a/apps/mobile/src/features/review/useReviewDiffPrewarming.ts
+++ b/apps/mobile/src/features/review/useReviewDiffPrewarming.ts
@@ -105,6 +105,7 @@ export function useReviewDiffPrewarming(input: {
}): void {
const { sections, selectedSectionId, threadKey } = input;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- prewarms pending review diff sections in idle callbacks and cancels the idle handle on cleanup
useEffect(() => {
if (!threadKey) {
return;
diff --git a/apps/mobile/src/features/settings/SettingsAuthRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsAuthRouteScreen.tsx
index 433a353e99c..276f51fcb38 100644
--- a/apps/mobile/src/features/settings/SettingsAuthRouteScreen.tsx
+++ b/apps/mobile/src/features/settings/SettingsAuthRouteScreen.tsx
@@ -36,6 +36,7 @@ function ConfiguredSettingsAuthRouteScreen() {
// Clerk reports sign-out only through its auth store (the native profile view
// and the T3 Connect page can both sign out), so this follows that store.
+ // 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
useEffect(() => {
if (hasBeenSignedIn && isLoaded && isSignedIn === false) {
navigation.goBack();
diff --git a/apps/mobile/src/features/settings/components/BranchNamingSettings.tsx b/apps/mobile/src/features/settings/components/BranchNamingSettings.tsx
index c660b3cfe1f..35f613ad8ca 100644
--- a/apps/mobile/src/features/settings/components/BranchNamingSettings.tsx
+++ b/apps/mobile/src/features/settings/components/BranchNamingSettings.tsx
@@ -50,6 +50,7 @@ export function BranchNamingSettings(props: {
const saveDrafts = useEffectEvent(() =>
send({ ...take("branchNamePrefix"), ...take("branchNameInstructions") }),
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- saves unsent branch naming drafts to server settings when the section unmounts
useEffect(() => () => saveDrafts(), []);
return (
<SettingsSection
diff --git a/apps/mobile/src/features/terminal/NativeTerminalSurface.tsx b/apps/mobile/src/features/terminal/NativeTerminalSurface.tsx
index ff3e0c1dae4..bcbf7d98ca7 100644
--- a/apps/mobile/src/features/terminal/NativeTerminalSurface.tsx
+++ b/apps/mobile/src/features/terminal/NativeTerminalSurface.tsx
@@ -220,6 +220,7 @@ const ReadyTerminalSurface = memo(function ReadyTerminalSurface(props: ReadyTerm
const writerRef = useRef<ReturnType<typeof createTerminalOutputWriter> | null>(null);
const [nativeReady, setNativeReady] = useState(false);
+ // 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
useEffect(() => {
const view = nativeRef.current;
if (!streaming || !nativeReady || view === null) return;
@@ -231,6 +232,7 @@ const ReadyTerminalSurface = memo(function ReadyTerminalSurface(props: ReadyTerm
};
}, [nativeReady, streaming]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- streams new terminal output into the native terminal view through its writer
useEffect(() => {
if (!streaming || !nativeReady || props.output === null) return;
void writerRef.current?.write(props.output).catch((error: unknown) => {
@@ -238,6 +240,7 @@ const ReadyTerminalSurface = memo(function ReadyTerminalSurface(props: ReadyTerm
});
}, [nativeReady, props.output, streaming]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- writes the native surface state to the terminal debug log after each relevant commit
useEffect(() => {
terminalDebugLog("native:surface", {
terminalKey: props.terminalKey,
diff --git a/apps/mobile/src/features/terminal/useTerminalExitNavigation.ts b/apps/mobile/src/features/terminal/useTerminalExitNavigation.ts
index a2aa873b296..6a5377fcf67 100644
--- a/apps/mobile/src/features/terminal/useTerminalExitNavigation.ts
+++ b/apps/mobile/src/features/terminal/useTerminalExitNavigation.ts
@@ -39,7 +39,7 @@ export function useTerminalExitNavigation(target: {
);
});
- // 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
+ // 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
useEffect(
() =>
navigation.addListener("focus", () => {
diff --git a/apps/mobile/src/features/threads/ComposerPopoverAnchor.android.tsx b/apps/mobile/src/features/threads/ComposerPopoverAnchor.android.tsx
index d8d882d6f91..54ccaec0d29 100644
--- a/apps/mobile/src/features/threads/ComposerPopoverAnchor.android.tsx
+++ b/apps/mobile/src/features/threads/ComposerPopoverAnchor.android.tsx
@@ -28,6 +28,7 @@ export function ComposerPopoverAnchor(props: { readonly children: ReactNode }) {
};
// Measure every render: composer padding or expansion can move the anchor without resizing it.
+ // 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
useEffect(() => {
measure();
host?.setContent(
@@ -50,6 +51,7 @@ export function ComposerPopoverAnchor(props: { readonly children: ReactNode }) {
});
const setHostContent = host?.setContent;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the popover host's content and shared height value when the anchor unmounts
useEffect(
() => () => {
setHostContent?.(null);
diff --git a/apps/mobile/src/features/threads/ComposerPopoverAnchor.tsx b/apps/mobile/src/features/threads/ComposerPopoverAnchor.tsx
index ecf9314791a..b38bfc12eeb 100644
--- a/apps/mobile/src/features/threads/ComposerPopoverAnchor.tsx
+++ b/apps/mobile/src/features/threads/ComposerPopoverAnchor.tsx
@@ -6,6 +6,7 @@ import { useComposerPopoverHost } from "./ComposerPopoverHost";
export function ComposerPopoverAnchor(props: { readonly children: ReactNode }) {
const popoverHeight = useComposerPopoverHost()?.popoverHeight;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- resets the popover host's shared height value when the anchor unmounts
useEffect(
() => () => {
popoverHeight?.set(0);
diff --git a/apps/mobile/src/features/threads/CustomSnoozeSheet.android.tsx b/apps/mobile/src/features/threads/CustomSnoozeSheet.android.tsx
index fd5a08d678a..220d4ec4deb 100644
--- a/apps/mobile/src/features/threads/CustomSnoozeSheet.android.tsx
+++ b/apps/mobile/src/features/threads/CustomSnoozeSheet.android.tsx
@@ -61,6 +61,7 @@ function systemUses24HourClock() {
export function CustomSnoozeSheet(props: Props) {
const { themeAppearance, themeVariables: colors } = useAppearancePreferences();
const [is24Hour, setIs24Hour] = useState(systemUses24HourClock);
+ // 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
useEffect(() => {
const subscription = AppState.addEventListener("change", (state) => {
if (state === "active") setIs24Hour(systemUses24HourClock());
diff --git a/apps/mobile/src/features/threads/HtmlRenderWebView.tsx b/apps/mobile/src/features/threads/HtmlRenderWebView.tsx
index 6b2f5d8b717..fd600f10618 100644
--- a/apps/mobile/src/features/threads/HtmlRenderWebView.tsx
+++ b/apps/mobile/src/features/threads/HtmlRenderWebView.tsx
@@ -95,6 +95,7 @@ export function HtmlRenderWebView(props: {
() => ({ uri: props.uri + htmlRenderThemeFragment(initialTheme) }),
[props.uri, initialTheme],
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- posts theme changes into the already loaded WebView
useEffect(() => {
if (shownTheme.current === null || shownTheme.current === theme) return;
shownTheme.current = theme;
diff --git a/apps/mobile/src/features/threads/McpAppFullscreenScreen.tsx b/apps/mobile/src/features/threads/McpAppFullscreenScreen.tsx
index aa6e4cce537..0cc02eaa669 100644
--- a/apps/mobile/src/features/threads/McpAppFullscreenScreen.tsx
+++ b/apps/mobile/src/features/threads/McpAppFullscreenScreen.tsx
@@ -106,6 +106,7 @@ export function McpAppFullscreenScreen({ route }: McpAppFullscreenScreenProps) {
const awaitingUser =
conversation?.hasPendingApprovals === true || conversation?.hasPendingUserInput === true;
// A request for the user is server state with no local handler to react in.
+ // 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
useEffect(() => {
if (awaitingUser && focused && !exitPending.current) navigation.goBack();
}, [awaitingUser, focused, navigation]);
diff --git a/apps/mobile/src/features/threads/McpAppWebView.tsx b/apps/mobile/src/features/threads/McpAppWebView.tsx
index 1c0c2e742e7..571d4afb93b 100644
--- a/apps/mobile/src/features/threads/McpAppWebView.tsx
+++ b/apps/mobile/src/features/threads/McpAppWebView.tsx
@@ -190,7 +190,7 @@ export function ThreadMcpApp(props: {
reopenDocument();
setPresentedFullscreen(false);
});
- // 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.
+ // 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.
useEffect(() => {
if (!presentedFullscreen) return;
return navigation.addListener("focus", () => returnedFromFullscreen());
@@ -237,6 +237,7 @@ export function ThreadMcpApp(props: {
// The attached WebView owns its host; state lets the tool-call effect pair
// a host only with an atom from a render after that host existed.
const [host, setHost] = useState<McpAppHost | null>(null);
+ // 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
useEffect(() => {
const previous = latest.current;
latest.current = live;
@@ -255,7 +256,7 @@ export function ThreadMcpApp(props: {
// The host sends the call once the app initializes, so a stored item that
// lands late still reaches it. A completed call can arrive under a new
// revision, which is a new atom, so the host follows the current one.
- // oxlint-disable-next-line t3code/react-effect-budget -- subscribes the MCP host to the current tool call
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes the MCP host to the current tool call
useEffect(() => {
if (host === null) return;
return appAtomRegistry.subscribe(
diff --git a/apps/mobile/src/features/threads/NewTaskDraftRouteScreen.tsx b/apps/mobile/src/features/threads/NewTaskDraftRouteScreen.tsx
index ed69a1f5a09..75ba59f2225 100644
--- a/apps/mobile/src/features/threads/NewTaskDraftRouteScreen.tsx
+++ b/apps/mobile/src/features/threads/NewTaskDraftRouteScreen.tsx
@@ -161,6 +161,7 @@ export function NewTaskDraftRouteScreen({ route }: StaticScreenProps<NewTaskDraf
// Native-stack reads the provider's prevent state, which commits a render
// after usePreventRemove updates its registry; the deferred thread selection
// (and the failure goBack) must wait for that commit.
+ // 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
useEffect(() => {
if (checkoutKey === null || checkoutPending || removalBlocked) return;
branchCheckouts.release(checkoutKey);
diff --git a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
index d5b5ff3c137..0eea8b24e75 100644
--- a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
+++ b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
@@ -370,6 +370,7 @@ export function NewTaskDraftScreen(props: {
(hasImportedIncomingShare && !incomingShare) ||
isIncomingShareUnavailable;
const appliedInitialProjectKeyRef = useRef<string | null>(null);
+ // 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
useEffect(() => {
if (isReturningToProjectPicker && requestedInitialProjectAvailable) {
// 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: {
const lastInitialProjectRefRef = useRef(props.initialProjectRef);
const initialPickerRef = useRef<"open" | "dismissed" | null>(null);
+ // 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
useEffect(() => {
if (props.draftId) {
return;
@@ -495,6 +497,7 @@ export function NewTaskDraftScreen(props: {
]);
const { loadBranches } = flow;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- requests the selected project's branch list from the server once per project
useEffect(() => {
if (!selectedProject) {
loadedBranchesProjectKeyRef.current = null;
diff --git a/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx b/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
index 611eb3c4d6d..12b2a893e50 100644
--- a/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
+++ b/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
@@ -271,6 +271,7 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps<NewTaskRoutePara
scratchStartInFlightRef.current = false;
}
+ // 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
useEffect(() => {
const destination = incomingShare?.destination;
if (!destination) {
diff --git a/apps/mobile/src/features/threads/QuestionAttachments.tsx b/apps/mobile/src/features/threads/QuestionAttachments.tsx
index c4d42c4fa0e..f2f1f839b90 100644
--- a/apps/mobile/src/features/threads/QuestionAttachments.tsx
+++ b/apps/mobile/src/features/threads/QuestionAttachments.tsx
@@ -50,6 +50,7 @@ export function QuestionAttachments(props: {
// The caller keys this component by request and question, so unmounting ends any open
// picker's scope.
const pickerScope = useRef<{ active: boolean }>({ active: false });
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens a scope that native picker and paste callbacks check, and closes it on unmount
useEffect(() => {
const scope = { active: true };
pickerScope.current = scope;
@@ -61,6 +62,7 @@ export function QuestionAttachments(props: {
const releaseFocus = useEffectEvent(() => {
if (focusedRef.current) onInputFocusChange?.(false);
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- releases keyboard ownership on unmount, since an unmounted native input never emits blur
useEffect(() => () => releaseFocus(), []);
const append = (
key: string,
diff --git a/apps/mobile/src/features/threads/ThreadArrangementSheet.tsx b/apps/mobile/src/features/threads/ThreadArrangementSheet.tsx
index 2fbb2b52520..de92e88d142 100644
--- a/apps/mobile/src/features/threads/ThreadArrangementSheet.tsx
+++ b/apps/mobile/src/features/threads/ThreadArrangementSheet.tsx
@@ -274,10 +274,12 @@ export function ThreadArrangementSheet(props: { onClose: () => void }) {
const orderVersion = rows
.map((row) => `${row.key}:${row.thread?.pinOrderKey}:${row.thread?.activeOrderKey}`)
.join("|");
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the in-progress drag gesture when the thread order changes underneath it
useEffect(() => {
// 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.
stop();
}, [orderVersion]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the pending drag animation frame on unmount
useEffect(
() => () => {
if (frame.current !== null) cancelAnimationFrame(frame.current);
diff --git a/apps/mobile/src/features/threads/ThreadComposer.tsx b/apps/mobile/src/features/threads/ThreadComposer.tsx
index 1e55ebc3d58..3f5529b345f 100644
--- a/apps/mobile/src/features/threads/ThreadComposer.tsx
+++ b/apps/mobile/src/features/threads/ThreadComposer.tsx
@@ -605,8 +605,10 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
sendBlockedReason === null &&
!modelUnavailable;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the workspace layout's composer-editing flag when the composer unmounts
useEffect(() => () => setComposerEditing(false), [setComposerEditing]);
// A pending sheet presentation or focus restore has no composer left to act on.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- disposes the pending settings sheet presentation and focus restore on unmount
useEffect(() => () => disposeSettingsSheetPresentation(), []);
const onPressPreview = (source: FilePreviewSource) => {
@@ -722,6 +724,7 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
settingsSheetPresentation.onDismissed();
});
+ // 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
useEffect(
() =>
// The native-stack patch exposes UIKit dismissal completion; restore the keyboard then.
diff --git a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx
index 3694a2ba9f4..93e77cb80a9 100644
--- a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+++ b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx
@@ -406,6 +406,7 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
// Android can lose IME hide callbacks on backgrounding. Quarantine translation on resume unless focused input retained its keyboard.
const [keyboardStateSuspect, setKeyboardStateSuspect] = useState(false);
const ownedInputFocusedRef = useRef(false);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to AppState on Android to mark keyboard state suspect when the app resumes
useEffect(() => {
if (Platform.OS !== "android") {
return;
@@ -419,6 +420,7 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
subscription.remove();
};
}, []);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the suspect flag whenever the native keyboard reports a visibility or height change
useEffect(() => {
// oxlint-disable-next-line react/set-state-in-effect -- Any native keyboard report clears the suspect flag set when the app resumed.
setKeyboardStateSuspect(false);
@@ -453,6 +455,7 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
const composerEditorRef = props.draftMode?.editorRef ?? defaultComposerEditorRef;
const isProviderSubagent = isProviderNativeSubagentThread(props.selectedThread.source);
const editingRunId = props.queuedRunEdit?.runId ?? null;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- focuses the composer editor on the next animation frame when a queued run edit starts
useEffect(() => {
if (editingRunId === null) return;
const frame = requestAnimationFrame(() => composerEditorRef.current?.focus());
@@ -540,6 +543,7 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
props.serverConfig?.environment.capabilities.threadSnooze === true &&
effectiveSnoozed(props.selectedThread, { now: lifecycleNow });
const snoozedUntil = props.selectedThread.snoozedUntil;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- arms a timer that refreshes the lifecycle clock when the thread's snooze expires
useEffect(() => {
if (!snoozed || snoozedUntil === null) return;
const timer = setTimeout(
@@ -743,6 +747,7 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
const loadEarlierForJump = useEffectEvent(() => {
if (jumpMessageId !== null) historyForJump?.onLoadThrough(jumpMessageId);
});
+ // 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
useEffect(() => {
if (jumpMessageId === null || jumpMessageLoaded || contentPresentationKind !== "ready") return;
if (historyForJump?.loading) return;
@@ -1007,6 +1012,7 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
setEndFollowEnabled(enabled);
};
// A jump this thread never reached lets go when it closes.
+ // 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
useEffect(() => {
if (threadScope.current.signal.aborted) threadScope.current = new AbortController();
const scope = threadScope.current;
diff --git a/apps/mobile/src/features/threads/ThreadFeed.tsx b/apps/mobile/src/features/threads/ThreadFeed.tsx
index ca9e6ba18d0..2aeae25ec7f 100644
--- a/apps/mobile/src/features/threads/ThreadFeed.tsx
+++ b/apps/mobile/src/features/threads/ThreadFeed.tsx
@@ -2208,7 +2208,7 @@ export const ThreadFeed = memo(function ThreadFeed({
props.threadId,
props.contentPresentation.kind,
]);
- // oxlint-disable-next-line react/exhaustive-effect-dependencies -- A scope change (thread or presentation) aborts the pending link lookup opened from the old scope.
+ // 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.
useLayoutEffect(() => () => markdownLinkRequest.current?.abort(), [markdownLinkScope]);
const [preview, setPreview] = useState<{
readonly scope: string;
@@ -2782,6 +2782,7 @@ export const ThreadFeed = memo(function ThreadFeed({
// Z: a native list scroll after the commit that rendered its target row. The
// row is often already measured, so no LegendList callback fires for that
// commit, and setEndFollow notifies the parent, so it can't run during render.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the native list to the jump target after the commit that rendered its row
useEffect(() => {
if (jumpIndex !== null) landJump(jumpIndex);
// 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({
}
// Timers and frames the feed schedules die with it.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the feed's scroll, reflow and copy timers and disclosure animation frames on unmount
useEffect(
() => () => {
if (userScrollSettleTimerRef.current !== null) clearTimeout(userScrollSettleTimerRef.current);
@@ -3062,6 +3064,7 @@ export const ThreadFeed = memo(function ThreadFeed({
const { textSizeKey } = workRowSizing;
const hasHtmlRenders = presentedFeed.some((entry) => entry.type === "html-render");
const previousRowGeometry = useRef({ textSizeKey, contentWidth });
+ // 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
useLayoutEffect(() => {
const previous = previousRowGeometry.current;
if (previous.textSizeKey === textSizeKey && previous.contentWidth === contentWidth) return;
diff --git a/apps/mobile/src/features/threads/ThreadGuestShareBar.tsx b/apps/mobile/src/features/threads/ThreadGuestShareBar.tsx
index 51858161c82..23d8711882a 100644
--- a/apps/mobile/src/features/threads/ThreadGuestShareBar.tsx
+++ b/apps/mobile/src/features/threads/ThreadGuestShareBar.tsx
@@ -70,6 +70,7 @@ export function ThreadGuestShareBar(props: {
// Keyed by the expiry, so a replaced link (even one already expired) gets its own timer.
const [expiredAt, setExpiredAt] = useState<string | null>(null);
const expiresAt = share?.expiresAt;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- arms a timer that flips the share label when the guest link expires
useEffect(() => {
if (expiresAt === undefined) return;
const timer = setTimeout(
diff --git a/apps/mobile/src/features/threads/ThreadInlineFilePreview.tsx b/apps/mobile/src/features/threads/ThreadInlineFilePreview.tsx
index 65ff9e0f371..1556ed9cdfa 100644
--- a/apps/mobile/src/features/threads/ThreadInlineFilePreview.tsx
+++ b/apps/mobile/src/features/threads/ThreadInlineFilePreview.tsx
@@ -84,6 +84,7 @@ function InlineAudio(props: PreviewProps & { readonly resolveUri: () => Promise<
}, []);
useMediaAudioSessionHold(status.playing);
const fullscreenVideoOpen = useFullscreenVideoOpen();
+ // 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
useEffect(() => {
if (fullscreenVideoOpen || status.didJustFinish || status.error) {
// 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<
}
if (fullscreenVideoOpen) pauseAudioPlayer(player);
}, [fullscreenVideoOpen, status.didJustFinish, status.error, player, requestPlayback]);
+ // 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
useEffect(() => {
active.current = true;
const subscription = AppState.addEventListener("change", (state) => {
diff --git a/apps/mobile/src/features/threads/ThreadQueueControl.tsx b/apps/mobile/src/features/threads/ThreadQueueControl.tsx
index c1abc19e9fd..5ea2d66c303 100644
--- a/apps/mobile/src/features/threads/ThreadQueueControl.tsx
+++ b/apps/mobile/src/features/threads/ThreadQueueControl.tsx
@@ -141,6 +141,7 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
const queuedRuns = workflow?.queuedRuns ?? [];
const hadQueuedRuns = useRef(queuedRuns.length > 0);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pops the navigator once the server-side queue empties after it had runs
useEffect(() => {
if (queuedRuns.length > 0) {
hadQueuedRuns.current = true;
diff --git a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx
index 1559adb60e1..cc0f9c83112 100644
--- a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx
+++ b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx
@@ -213,7 +213,7 @@ function UnavailableThreadDraftRedirect(props: { readonly environmentId: Environ
}),
);
});
- // oxlint-disable-next-line t3code/react-effect-budget -- replaces this route in the navigator
+ // 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
useEffect(() => {
openDraft();
}, []);
@@ -451,6 +451,7 @@ function ThreadRouteContent(
: chosenInspectorMode;
return mode === "files" && selectedThreadCwd === null ? null : mode;
})();
+ // 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
useEffect(() => {
if (
props.inspectorPresentation === undefined &&
@@ -471,6 +472,7 @@ function ThreadRouteContent(
]);
const revealPreview = useEffectEvent(() => showAuxiliaryPane("inspector"));
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens the workspace navigator's inspector pane when route params bring a preview target
useEffect(() => {
if (previewTarget) revealPreview();
}, [previewTarget]);
diff --git a/apps/mobile/src/features/threads/ThreadScreenHost.tsx b/apps/mobile/src/features/threads/ThreadScreenHost.tsx
index 169fde22930..46626eea071 100644
--- a/apps/mobile/src/features/threads/ThreadScreenHost.tsx
+++ b/apps/mobile/src/features/threads/ThreadScreenHost.tsx
@@ -65,6 +65,7 @@ export function ThreadScreenHost({ children }: { readonly children: ReactNode })
export function ThreadScreenBinding(props: ThreadDetailScreenProps) {
const store = useContext(ThreadScreenContext)!;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes the route's thread screen props to the external store the outlet reads
useLayoutEffect(() => {
store.publish({ props });
});
@@ -79,6 +80,7 @@ export function ThreadScreenFallback({
readonly header?: ReactNode;
}) {
const store = useContext(ThreadScreenContext)!;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes the fallback content and header to the external store the outlet reads
useLayoutEffect(() => {
store.publish({ fallback: children, header });
});
diff --git a/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx b/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
index ac382d101b8..11d8710470d 100644
--- a/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
+++ b/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
@@ -362,6 +362,7 @@ function ThreadSettingsSessionProvider(
favorites: legacyFavorites,
}).favorites;
const saveSettings = useAtomCommand(serverEnvironment.updateSettings, "model favorites update");
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- writes the one-time legacy model favorites migration to server settings once per connection
useEffect(() => {
if (
!props.environmentId ||
diff --git a/apps/mobile/src/features/threads/floating-working-control.tsx b/apps/mobile/src/features/threads/floating-working-control.tsx
index 2b41da1825b..998c8bae4b6 100644
--- a/apps/mobile/src/features/threads/floating-working-control.tsx
+++ b/apps/mobile/src/features/threads/floating-working-control.tsx
@@ -104,6 +104,7 @@ export function FloatingWorkingControl(props: {
);
const separationProgress = useSharedValue(props.showScrollToEnd ? 1 : 0);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- animates the Reanimated separation value when scroll-to-end visibility changes
useEffect(() => {
separationProgress.set(withTiming(props.showScrollToEnd ? 1 : 0, CONTROL_TIMING));
}, [props.showScrollToEnd, separationProgress]);
@@ -133,6 +134,7 @@ export function FloatingWorkingControl(props: {
};
const hasStatus = props.status !== null;
const hasCapsule = hasStatus || hasQueue || hasAgents || hasPreview;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the Reanimated capsule width value and measured width when the status goes away
useEffect(() => {
if (!hasStatus) {
measuredWidthRef.current = null;
diff --git a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
index a91443401a2..92bc95a8c44 100644
--- a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
+++ b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
@@ -66,6 +66,7 @@ export function GitOverviewSheet(props: GitOverviewSheetProps) {
const navigation = useNavigation();
const { environmentId, threadId } = props.route.params;
const isBlankLink = environmentId.trim().length === 0 || threadId.trim().length === 0;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pops the navigator when the route link names a blank environment or thread
useEffect(() => {
if (isBlankLink) navigation.goBack();
}, [isBlankLink, navigation]);
diff --git a/apps/mobile/src/features/threads/new-task-flow-provider.tsx b/apps/mobile/src/features/threads/new-task-flow-provider.tsx
index 87e2c5254db..06cb9c1f970 100644
--- a/apps/mobile/src/features/threads/new-task-flow-provider.tsx
+++ b/apps/mobile/src/features/threads/new-task-flow-provider.tsx
@@ -388,6 +388,7 @@ export function NewTaskFlowProvider(
})();
const selectedProjectDraftKey = selectedProject ? activeDraftKey : null;
+ // 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
useEffect(() => {
// A route that names a draft binds that draft, or returns to the picker.
if (
diff --git a/apps/mobile/src/features/threads/thread-inspector-content-stack.tsx b/apps/mobile/src/features/threads/thread-inspector-content-stack.tsx
index 1dafb439f2d..ef4efad1926 100644
--- a/apps/mobile/src/features/threads/thread-inspector-content-stack.tsx
+++ b/apps/mobile/src/features/threads/thread-inspector-content-stack.tsx
@@ -57,6 +57,7 @@ export function ThreadInspectorContentStack(props: {
() => new Set([props.mode]),
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- keeps opened UIKit inspector views mounted and prewarms the alternate inspector after a timer
useEffect(() => {
// oxlint-disable-next-line react/set-state-in-effect -- Keeps opened inspector views mounted so UIKit keeps their focus and scroll.
setMountedModes((current) => {
diff --git a/apps/mobile/src/features/threads/thread-work-log.tsx b/apps/mobile/src/features/threads/thread-work-log.tsx
index 62251650c5b..c07a04217de 100644
--- a/apps/mobile/src/features/threads/thread-work-log.tsx
+++ b/apps/mobile/src/features/threads/thread-work-log.tsx
@@ -170,6 +170,7 @@ export function ThreadDisclosureChevron(props: {
const expandedAngle = props.collapsedDirection === "right" ? 90 : 180;
const rotation = useSharedValue(props.expanded ? expandedAngle : 0);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- drives the chevron's Reanimated rotation value when the expanded state changes
useLayoutEffect(() => {
rotation.set(
withTiming(props.expanded ? expandedAngle : 0, {
@@ -278,6 +279,7 @@ export function ShimmeringWorkContent(props: {
// Runs on React Native's native driver instead of Reanimated, whose
// per-frame commits starve React's while commit pausing is disabled
// (package.json). See docs/internals/performance-regressions.md.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- starts the native-driver shimmer loop while visible and active, and stops it on cleanup
useEffect(() => {
progress.setValue(0);
if (contentWidth <= 0 || reducedMotion || !appIsActive || !screenIsFocused) return;
@@ -672,6 +674,7 @@ function ThreadWorkGroupList(props: {
});
// Native ScrollView reports size after LegendList lays out rows. Use LegendList's JS size
// so group height and row measurements settle in the same commit.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to LegendList's totalSize state to report content height in the same commit
useLayoutEffect(() => {
const list = listRef.current;
if (!list) return;
diff --git a/apps/mobile/src/features/threads/use-composer-command-menu.ts b/apps/mobile/src/features/threads/use-composer-command-menu.ts
index 89afc891015..493de489a3c 100644
--- a/apps/mobile/src/features/threads/use-composer-command-menu.ts
+++ b/apps/mobile/src/features/threads/use-composer-command-menu.ts
@@ -275,6 +275,7 @@ export function useComposerCommandMenu({
);
// Every draft change rechecks a stale snapshot, including drafts written by
// another surface (a prompt link) that never move the editor selection.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- refreshes the provider workspace snapshot atom whenever the draft text changes from any surface
useEffect(() => {
refreshWorkspaceSnapshot();
}, [
diff --git a/apps/mobile/src/features/threads/useFileChipShare.ts b/apps/mobile/src/features/threads/useFileChipShare.ts
index cff5703159b..12e45b69178 100644
--- a/apps/mobile/src/features/threads/useFileChipShare.ts
+++ b/apps/mobile/src/features/threads/useFileChipShare.ts
@@ -22,6 +22,7 @@ export function useFileChipShare(
reportFailure: false,
});
const requestRef = useRef<AbortController | null>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- aborts the in-flight file share download when the component unmounts
useEffect(() => () => requestRef.current?.abort(), []);
return (target: FileChipTarget) => {
diff --git a/apps/mobile/src/features/voice-input/useVoiceInputController.ts b/apps/mobile/src/features/voice-input/useVoiceInputController.ts
index c336d68fd9d..e26672b5b48 100644
--- a/apps/mobile/src/features/voice-input/useVoiceInputController.ts
+++ b/apps/mobile/src/features/voice-input/useVoiceInputController.ts
@@ -27,6 +27,7 @@ export function useVoiceInputController(input: {
// oxlint-disable-next-line react/refs -- Transcription finishes asynchronously and must reach the composer's current selection setter, not the one captured at start.
latestInput.current = input;
const mounted = useRef(true);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- tracks mount so async transcription results skip a composer that has unmounted
useEffect(() => {
mounted.current = true;
return () => {
diff --git a/apps/mobile/src/features/workspace/WorkspaceNativeTabs.ios.tsx b/apps/mobile/src/features/workspace/WorkspaceNativeTabs.ios.tsx
index 344e787d044..a29110dfde4 100644
--- a/apps/mobile/src/features/workspace/WorkspaceNativeTabs.ios.tsx
+++ b/apps/mobile/src/features/workspace/WorkspaceNativeTabs.ios.tsx
@@ -36,6 +36,7 @@ function RetainedWorkspaceTab(props: {
const workspace = useWorkspaceTabs()!;
// Whether this slot is the visible one, read by cleanups after the switch has committed.
const activeRef = useRef(props.active);
+ // 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
useLayoutEffect(() => {
activeRef.current = props.active;
}, [props.active]);
diff --git a/apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx b/apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx
index 2278ee9ba7c..b09bd41b1e4 100644
--- a/apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx
+++ b/apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx
@@ -115,6 +115,7 @@ export function WorkspaceToolbar(props: {
return () => cancelAnimationFrame(frame);
}, [restoreSearch]),
);
+ // 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
useEffect(() => {
if (!tabActive) return;
const frame = requestAnimationFrame(restoreSearch);
diff --git a/apps/mobile/src/features/workspace/WorkspaceToolbar.tsx b/apps/mobile/src/features/workspace/WorkspaceToolbar.tsx
index 70c606353dc..a8a87d9693f 100644
--- a/apps/mobile/src/features/workspace/WorkspaceToolbar.tsx
+++ b/apps/mobile/src/features/workspace/WorkspaceToolbar.tsx
@@ -86,6 +86,7 @@ export function WorkspaceToolbar(props: {
else cancelSearch();
return true;
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- focuses the search TextInput after a focus request renders it
useEffect(() => {
if (focusRequest > 0) input.current?.focus();
}, [focusRequest]);
diff --git a/apps/mobile/src/lib/attachmentDocument.ts b/apps/mobile/src/lib/attachmentDocument.ts
index 09650d2be1a..76fbd335ce0 100644
--- a/apps/mobile/src/lib/attachmentDocument.ts
+++ b/apps/mobile/src/lib/attachmentDocument.ts
@@ -84,6 +84,7 @@ export function useAttachmentDocument(input: {
const kind = filePreviewKind(input, { richDocuments: false });
const delimiter = filePreviewDelimiter(input);
const shareController = useRef<AbortController | null>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- aborts the in-flight attachment share download when the component unmounts
useEffect(() => () => shareController.current?.abort(), []);
const resource = {
_tag: "attachment" as const,
diff --git a/apps/mobile/src/lib/backHandler.ts b/apps/mobile/src/lib/backHandler.ts
index c1005998b27..1a7e399106e 100644
--- a/apps/mobile/src/lib/backHandler.ts
+++ b/apps/mobile/src/lib/backHandler.ts
@@ -10,7 +10,7 @@ import { BackHandler } from "react-native";
export function useHardwareBack(active: boolean, onBack: () => boolean) {
const focused = useIsFocused();
const handleBack = useEffectEvent(onBack);
- // oxlint-disable-next-line t3code/react-effect-budget -- subscribes to BackHandler for the focused screen's lifetime
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to BackHandler for the focused screen's lifetime
useEffect(() => {
if (!active || !focused) return;
const subscription = BackHandler.addEventListener("hardwareBackPress", () => handleBack());
diff --git a/apps/mobile/src/lib/previewPresentation.ts b/apps/mobile/src/lib/previewPresentation.ts
index 16ff63eb365..2c398741e6d 100644
--- a/apps/mobile/src/lib/previewPresentation.ts
+++ b/apps/mobile/src/lib/previewPresentation.ts
@@ -25,7 +25,7 @@ export function usePreviewPresentation(
// can describe a different route. The preview belongs to this navigation route.
const navigation = useNavigation();
const close = useEffectEvent(onRequestClose);
- // oxlint-disable-next-line t3code/react-effect-budget -- Navigation blur is an external event and the open state belongs to the caller.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Navigation blur is an external event and the open state belongs to the caller.
useEffect(() => {
if (presentationKey === null) return;
Keyboard.dismiss();
diff --git a/apps/mobile/src/lib/useMediaVideoPlayback.ts b/apps/mobile/src/lib/useMediaVideoPlayback.ts
index d0950cd3ef9..1f96b845c5c 100644
--- a/apps/mobile/src/lib/useMediaVideoPlayback.ts
+++ b/apps/mobile/src/lib/useMediaVideoPlayback.ts
@@ -20,6 +20,7 @@ export function useMediaVideoPlayback(
const { isPlaying } = useEvent(player, "playingChange", { isPlaying: player.playing });
useMediaAudioSessionHold(isPlaying);
+ // 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
useEffect(() => {
active.current = focused && !paused && AppState.currentState === "active";
if (!active.current) interruption.current += 1;
diff --git a/apps/mobile/src/lib/videoAudioSession.ts b/apps/mobile/src/lib/videoAudioSession.ts
index 55bb933806d..aba59954703 100644
--- a/apps/mobile/src/lib/videoAudioSession.ts
+++ b/apps/mobile/src/lib/videoAudioSession.ts
@@ -56,6 +56,7 @@ export function useFullscreenVideoOpen(): boolean {
}
export function useMediaAudioSessionHold(active: boolean): void {
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- holds the shared native audio session while media plays and releases it on cleanup
useEffect(() => {
if (!active) return;
mediaPlaybackStarted();
diff --git a/apps/mobile/src/native/NativeHeaderToolbar.tsx b/apps/mobile/src/native/NativeHeaderToolbar.tsx
index 88b72e2335f..3efcacdee03 100644
--- a/apps/mobile/src/native/NativeHeaderToolbar.tsx
+++ b/apps/mobile/src/native/NativeHeaderToolbar.tsx
@@ -244,6 +244,7 @@ function NativeHeaderToolbarRoot(props: {
}, [props.children, committedHandlers]);
// Native retains actions when unchanged presentation skips re-registration.
// Publish only committed handlers; abandoned renders must not replace them.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes committed toolbar handlers to the ref native actions call; discarded renders must not leak
useLayoutEffect(() => {
committedHandlers.current = handlers;
return () => {
@@ -256,6 +257,7 @@ function NativeHeaderToolbarRoot(props: {
[items],
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears this placement's native header items through the navigator when the toolbar unmounts
useLayoutEffect(() => {
if (!setOptions) return;
return () => {
diff --git a/apps/mobile/src/native/StackHeader.tsx b/apps/mobile/src/native/StackHeader.tsx
index b51a8e9a4ef..1077ef0dd9f 100644
--- a/apps/mobile/src/native/StackHeader.tsx
+++ b/apps/mobile/src/native/StackHeader.tsx
@@ -200,6 +200,7 @@ export function NativeStackScreenOptions(props: {
// phase: a render React discards must not leak its closures into the header.
// It runs before the tab check so wrappers already installed in an inactive
// tab's header still call the newest closures.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- writes stabilized header options to the navigator after commit so discarded renders leave no closures
useLayoutEffect(() => {
const normalizedOptions = normalizeScreenOptions(props.options);
const stableOptions = normalizedOptions
@@ -236,6 +237,7 @@ export function NativeStackScreenOptions(props: {
);
}, [setOptions, props.options, props.optionsVersion, tabActive]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes the given listeners to navigator events for the screen's lifetime
useEffect(() => {
if (!navigation || !props.listeners) {
return;
diff --git a/apps/mobile/src/native/T3ComposerEditor.ios.tsx b/apps/mobile/src/native/T3ComposerEditor.ios.tsx
index 2839ee51ce4..c649b12292b 100644
--- a/apps/mobile/src/native/T3ComposerEditor.ios.tsx
+++ b/apps/mobile/src/native/T3ComposerEditor.ios.tsx
@@ -237,6 +237,7 @@ export function ComposerEditor({
mostRecentEventCount: controlledEventCount,
isNativeEcho,
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- prunes native editor event snapshots once a committed payload acknowledges them
useEffect(() => {
if (!acknowledgesLatestNativeEvent) return;
nativeEventSnapshotsRef.current = pruneAcknowledgedComposerNativeEvents(
@@ -245,6 +246,7 @@ export function ComposerEditor({
);
}, [acknowledgesLatestNativeEvent, mostRecentEventCount, nativeEventSnapshotsRef]);
const assumedValue = props.value;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- records the committed controlled payload as the native editor's assumed state
useEffect(() => {
// Newer native events make this payload stale; do not record it as applied.
if (isNativeEcho || controlledEventCount !== mostRecentEventCountRef.current) return;
diff --git a/apps/mobile/src/native/T3ComposerEditor.native.tsx b/apps/mobile/src/native/T3ComposerEditor.native.tsx
index beec603e47d..e1ed9f74256 100644
--- a/apps/mobile/src/native/T3ComposerEditor.native.tsx
+++ b/apps/mobile/src/native/T3ComposerEditor.native.tsx
@@ -234,6 +234,7 @@ export function ComposerEditor({
mostRecentEventCount: controlledEventCount,
isNativeEcho,
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- prunes native editor event snapshots once a committed payload acknowledges them
useEffect(() => {
if (!acknowledgesLatestNativeEvent) return;
nativeEventSnapshotsRef.current = pruneAcknowledgedComposerNativeEvents(
@@ -242,6 +243,7 @@ export function ComposerEditor({
);
}, [acknowledgesLatestNativeEvent, mostRecentEventCount, nativeEventSnapshotsRef]);
const assumedValue = props.value;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- records the committed controlled payload as the native editor's assumed state
useEffect(() => {
// Newer native events make this payload stale; do not record it as applied.
if (isNativeEcho || controlledEventCount !== mostRecentEventCountRef.current) return;
diff --git a/apps/mobile/src/native/V5StackHeader.ios.tsx b/apps/mobile/src/native/V5StackHeader.ios.tsx
index 969960b2c92..21c242ba91f 100644
--- a/apps/mobile/src/native/V5StackHeader.ios.tsx
+++ b/apps/mobile/src/native/V5StackHeader.ios.tsx
@@ -270,6 +270,7 @@ export function V5StackHeader(props: {
const autofocusRef = searchOptions?.ref ?? searchRef;
// iOS ignores the native autoFocus prop, and SearchBar's imperative handle changes every
// commit, so a ref callback would refocus on each render; focus once after the header mounts.
+ // 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
useEffect(() => {
if (!searchOptions?.autoFocus) return;
const frame = requestAnimationFrame(() => autofocusRef.current?.focus());
diff --git a/apps/mobile/src/native/useRetryingImageSource.ts b/apps/mobile/src/native/useRetryingImageSource.ts
index af64625d040..bf561ec9d19 100644
--- a/apps/mobile/src/native/useRetryingImageSource.ts
+++ b/apps/mobile/src/native/useRetryingImageSource.ts
@@ -11,6 +11,7 @@ import type { MarkdownImageSourceResolver } from "./SelectableMarkdownText.types
export function useRetryingImageSource(resolve: MarkdownImageSourceResolver | undefined) {
const latestRef = useRef(resolve);
const retriesRef = useRef(new Set<() => void>());
+ // 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
useLayoutEffect(() => {
latestRef.current = resolve;
const retries = [...retriesRef.current];
diff --git a/apps/mobile/src/state/mediaActions.ts b/apps/mobile/src/state/mediaActions.ts
index dde7e2fe6b5..b8736d6d3c3 100644
--- a/apps/mobile/src/state/mediaActions.ts
+++ b/apps/mobile/src/state/mediaActions.ts
@@ -55,6 +55,7 @@ export function useMediaActions(source: MediaActionsSource | undefined, onOpenFi
);
const controller = useRef<AbortController | null>(null);
const [sharing, setSharing] = useState(false);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- aborts the in-flight media share when the component unmounts
useEffect(() => () => controller.current?.abort(), []);
const share = () => {
diff --git a/apps/mobile/src/state/olderSettledShelf.ts b/apps/mobile/src/state/olderSettledShelf.ts
index 9c72393162c..1d5088b2b7d 100644
--- a/apps/mobile/src/state/olderSettledShelf.ts
+++ b/apps/mobile/src/state/olderSettledShelf.ts
@@ -39,6 +39,7 @@ export function useOlderSettledShelf(input: {
}));
const shelfKey = JSON.stringify(shelfScopes);
const shelf = useAtomValue(olderSettledThreads.shelfAtom(shelfScopes));
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- mounts older settled thread pages into the shared thread registry while the shelf shows them
useEffect(() => {
const releases = (JSON.parse(shelfKey) as typeof shelfScopes).flatMap(({ scope, pages }) =>
pages === 0
@@ -92,6 +93,7 @@ export function useOlderSettledShelfGrowth(
visibleCount: shelf.visibleCount,
});
const { grow, pages } = shelf;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- requests more shelf pages when the loaded rows list fewer threads than the shelf shows
useEffect(() => {
if (wanted !== pages) grow(wanted);
}, [wanted, pages, grow]);
diff --git a/apps/mobile/src/state/peerLinks.ts b/apps/mobile/src/state/peerLinks.ts
index c0b36dfadec..bdcc66e3205 100644
--- a/apps/mobile/src/state/peerLinks.ts
+++ b/apps/mobile/src/state/peerLinks.ts
@@ -28,7 +28,7 @@ export function useLinkableMachines(environmentId: EnvironmentId, enabled: boole
const discoverIfUnasked = useEffectEvent(() => {
if (discovery.environments.size === 0 && !discovery.refreshing) void refreshDiscovery();
});
- // 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
+ // 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
useEffect(() => {
if (enabled) discoverIfUnasked();
}, [enabled]);
diff --git a/apps/mobile/src/state/queries.ts b/apps/mobile/src/state/queries.ts
index d1b828081b7..de600a929dd 100644
--- a/apps/mobile/src/state/queries.ts
+++ b/apps/mobile/src/state/queries.ts
@@ -89,6 +89,7 @@ export interface ComposerPathSearchTarget {
export function useDebouncedValue<A>(value: A, delayMs: number): A {
const [debounced, setDebounced] = useState(value);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- timer that publishes the value after the delay and clears on change
useEffect(() => {
const timer = setTimeout(() => {
setDebounced(value);
@@ -227,6 +228,7 @@ export function useThreadSearch(
: { query: "", matches: EMPTY_THREAD_SEARCH_MATCHES };
// The shown results' rows stay mounted until newer results replace them.
const shownKey = visible.query === "" ? null : searchKeyOf(visible.query);
+ // 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
useEffect(() => {
if (shownKey === null) return;
const environments = (JSON.parse(shownKey) as [ReadonlyArray<EnvironmentId>])[0];
diff --git a/apps/mobile/src/state/threads.ts b/apps/mobile/src/state/threads.ts
index ee629708e3a..28cb2f88c0d 100644
--- a/apps/mobile/src/state/threads.ts
+++ b/apps/mobile/src/state/threads.ts
@@ -51,6 +51,7 @@ export function useThreadFamily(
environmentId: EnvironmentId | null,
rootThreadId: ThreadId | null,
): void {
+ // 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
useEffect(() => {
if (environmentId === null || rootThreadId === null) return;
return threadFamilies.mount(appAtomRegistry, environmentId, rootThreadId);
diff --git a/apps/mobile/src/state/use-composer-drafts.ts b/apps/mobile/src/state/use-composer-drafts.ts
index 70c9503f34c..8c049cd4b61 100644
--- a/apps/mobile/src/state/use-composer-drafts.ts
+++ b/apps/mobile/src/state/use-composer-drafts.ts
@@ -2038,6 +2038,7 @@ export function useComposerDraftSettings(draftKey: string | null): ComposerDraft
const settings = useAtomValue(
draftKey ? composerDraftSettingsAtom(draftKey) : EMPTY_DRAFT_SETTINGS_ATOM,
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- starts loading persisted composer drafts from native storage on first use
useEffect(() => {
ensureComposerDraftsLoaded();
}, []);
@@ -2046,6 +2047,7 @@ export function useComposerDraftSettings(draftKey: string | null): ComposerDraft
export function useComposerDraft(draftKey: string | null): ComposerDraft {
const draft = useAtomValue(draftKey ? composerDraftAtom(draftKey) : EMPTY_DRAFT_ATOM);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- starts loading persisted composer drafts from native storage on first use
useEffect(() => {
ensureComposerDraftsLoaded();
}, []);
@@ -2054,6 +2056,7 @@ export function useComposerDraft(draftKey: string | null): ComposerDraft {
export function useStickyComposerModelSelection(): ModelSelection | null {
const selection = useAtomValue(stickyComposerModelSelectionAtom);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- starts loading persisted composer drafts from native storage on first use
useEffect(() => {
ensureComposerDraftsLoaded();
}, []);
diff --git a/apps/mobile/src/state/use-pull-to-refresh.ts b/apps/mobile/src/state/use-pull-to-refresh.ts
index 98686da3234..cb61404b7ab 100644
--- a/apps/mobile/src/state/use-pull-to-refresh.ts
+++ b/apps/mobile/src/state/use-pull-to-refresh.ts
@@ -10,6 +10,7 @@ export function usePullToRefresh<A, E>(atom: Atom.Atom<AsyncResult.AsyncResult<A
);
const [refreshingAtom, setRefreshingAtom] = useState<typeof atom>(null);
if (refreshingAtom !== null && refreshingAtom !== atom) setRefreshingAtom(null);
+ // 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
useEffect(
() => () => {
if (request.current?.atom === atom) request.current.controller.abort();
diff --git a/apps/mobile/src/widgets/SubscriptionUsageCoordinator.tsx b/apps/mobile/src/widgets/SubscriptionUsageCoordinator.tsx
index 2540b17374f..c83e68443bb 100644
--- a/apps/mobile/src/widgets/SubscriptionUsageCoordinator.tsx
+++ b/apps/mobile/src/widgets/SubscriptionUsageCoordinator.tsx
@@ -29,6 +29,7 @@ export function SubscriptionUsageCoordinator() {
const catalog = useAtomValue(environmentCatalog.catalogValueAtom);
const snapshot = useAtomValue(snapshotAtom);
const androidAppearance = Platform.OS === "android" ? themeAppearance : null;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes subscription usage and theme to the native home screen widget
useEffect(() => {
if (!catalog.isReady || !appearanceReady) return;
void Promise.resolve()
diff --git a/apps/web/src/browser/BrowserSurfaceSlot.tsx b/apps/web/src/browser/BrowserSurfaceSlot.tsx
index 7525f66350f..e00b002ca00 100644
--- a/apps/web/src/browser/BrowserSurfaceSlot.tsx
+++ b/apps/web/src/browser/BrowserSurfaceSlot.tsx
@@ -77,6 +77,7 @@ export function BrowserSurfaceSlot(props: {
};
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes visibility, radius and stacking to the desktop browser surface after layout
useLayoutEffect(() => {
presentationRef.current = { visible, cornerRadius, zIndex };
updateRef.current?.();
diff --git a/apps/web/src/browser/HostedBrowserWebview.tsx b/apps/web/src/browser/HostedBrowserWebview.tsx
index cd1852d3692..70eef380dbf 100644
--- a/apps/web/src/browser/HostedBrowserWebview.tsx
+++ b/apps/web/src/browser/HostedBrowserWebview.tsx
@@ -105,6 +105,7 @@ export function HostedBrowserWebview(props: {
const serverColorScheme = serverRendering?.colorScheme;
const serverZoomFactor = serverRendering?.zoomFactor;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- leases the desktop preview tab for this webview and releases it on cleanup
useEffect(() => {
if (!clientSettingsHydrated) return;
crashRecoveryRef.current = INITIAL_WEBVIEW_CRASH_RECOVERY_STATE;
@@ -119,11 +120,13 @@ export function HostedBrowserWebview(props: {
};
}, [clientSettingsHydrated, runtimeTabId, serverDriven, tabId, threadRef.threadId]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- applies the server color scheme to the desktop preview tab through the desktop bridge
useEffect(() => {
const bridge = window.desktopBridge?.preview;
if (!bridge || serverColorScheme === undefined) return;
withDesktopTab(runtimeTabId, () => bridge.setColorScheme(runtimeTabId, serverColorScheme));
}, [runtimeTabId, serverColorScheme]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- applies the server zoom factor to the desktop preview tab through the desktop bridge
useEffect(() => {
const bridge = window.desktopBridge?.preview;
if (!bridge || serverZoomFactor === undefined) return;
@@ -141,6 +144,7 @@ export function HostedBrowserWebview(props: {
webviewRef.current = node as ElectronWebview | null;
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- registers the webview's webContents with the desktop bridge and listens for crashes and focus
useEffect(() => {
const webview = webviewRef.current;
const bridge = previewBridge;
@@ -266,11 +270,13 @@ export function HostedBrowserWebview(props: {
});
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- schedules a frame that publishes the webview layout and scroll to the browser surface store
useEffect(() => {
const frameId = window.requestAnimationFrame(syncContentPresentation);
return () => window.cancelAnimationFrame(frameId);
}, [syncContentPresentation]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the webview wrapper element to its origin for a new tab or viewport size
useEffect(() => {
const wrapper = wrapperRef.current;
if (!wrapper) return;
diff --git a/apps/web/src/browser/ServerBrowserSurface.tsx b/apps/web/src/browser/ServerBrowserSurface.tsx
index 45c84dba0e7..c6ad2f51c3f 100644
--- a/apps/web/src/browser/ServerBrowserSurface.tsx
+++ b/apps/web/src/browser/ServerBrowserSurface.tsx
@@ -308,6 +308,7 @@ export function ServerBrowserSurface(props: {
[pdfUrl, send],
);
+ // 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
useEffect(() => {
const element = canvasRef.current?.parentElement;
if (!element) return;
@@ -353,6 +354,7 @@ export function ServerBrowserSurface(props: {
};
}, [followSize]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens the preview stream client and paints its frames onto the canvas while visible
useEffect(() => {
const canvas = canvasRef.current;
if (!visible || accessDenied || hostSetup || !access || !cap || !canvas) return;
@@ -457,6 +459,7 @@ export function ServerBrowserSurface(props: {
visible,
]);
+ // 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
useEffect(() => {
const canvas = canvasRef.current;
if (!canvas) return;
@@ -477,6 +480,7 @@ export function ServerBrowserSurface(props: {
return () => canvas.removeEventListener("wheel", onWheel);
}, [pagePoint, queueWheel]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the pending input animation frame when the component unmounts
useEffect(
() => () => {
if (inputFrameRef.current !== null) cancelAnimationFrame(inputFrameRef.current);
diff --git a/apps/web/src/browser/useBrowserViewportResize.ts b/apps/web/src/browser/useBrowserViewportResize.ts
index 6fc24b54689..535c2034d0b 100644
--- a/apps/web/src/browser/useBrowserViewportResize.ts
+++ b/apps/web/src/browser/useBrowserViewportResize.ts
@@ -60,6 +60,7 @@ export function useBrowserViewportResize(options: {
? resolveBrowserDeviceViewportLayout(containerSize, effectiveViewport, zoomFactor)
: resolveBrowserViewportLayout(containerSize, effectiveViewport, zoomFactor);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the drag and the keyboard commit timer when the component unmounts
useEffect(
() => () => {
dragVersionRef.current += 1;
@@ -73,6 +74,7 @@ export function useBrowserViewportResize(options: {
[],
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the pending keyboard viewport commit timer once the source viewport changes
useEffect(() => {
const pending = keyboardViewportRef.current;
if (!pending || pending.sourceKey === sourceViewportKey) return;
diff --git a/apps/web/src/cloud/managedAuth.tsx b/apps/web/src/cloud/managedAuth.tsx
index 8c3c866f957..59bc69f7640 100644
--- a/apps/web/src/cloud/managedAuth.tsx
+++ b/apps/web/src/cloud/managedAuth.tsx
@@ -65,6 +65,7 @@ export function ManagedRelayAuthProvider({ children }: { readonly children: Reac
// ClerkProvider creates the Clerk instance and owns its lifetime, so the
// account service observes it for as long as this provider is mounted.
const clerk = useClerk();
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- attaches the Clerk instance to the managed relay account service for the provider's lifetime
useEffect(() => managedRelayAccountService.attach(clerk), [clerk]);
return children;
}
diff --git a/apps/web/src/commandPaletteStore.ts b/apps/web/src/commandPaletteStore.ts
index f8dee5413fb..b708f3ad6e5 100644
--- a/apps/web/src/commandPaletteStore.ts
+++ b/apps/web/src/commandPaletteStore.ts
@@ -33,7 +33,7 @@ export function isCommandPaletteMounted(): boolean {
* palette cannot stay open, so the last unmount resets the store.
*/
export function useCommandPaletteMount(): void {
- // 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.
+ // 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.
useEffect(() => {
mountedPalettes += 1;
return () => {
diff --git a/apps/web/src/components/AnimatedHeight.tsx b/apps/web/src/components/AnimatedHeight.tsx
index 2c443258320..a098851233a 100644
--- a/apps/web/src/components/AnimatedHeight.tsx
+++ b/apps/web/src/components/AnimatedHeight.tsx
@@ -16,6 +16,7 @@ export function AnimatedHeight({
readonly isClipping: boolean;
}>({ height: null, isClipping: false });
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- fallback timer that ends clipping when the height transition never reports its end
useEffect(() => {
if (!heightState.isClipping) return;
const timeoutId = window.setTimeout(() => {
@@ -30,6 +31,7 @@ export function AnimatedHeight({
heightState.isClipping,
]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the content element and observes its size before paint to animate height
useLayoutEffect(() => {
if (holdHeight) return;
const element = contentRef.current;
diff --git a/apps/web/src/components/AnimatedWidth.tsx b/apps/web/src/components/AnimatedWidth.tsx
index ef152402d6d..dd2bfce7f0a 100644
--- a/apps/web/src/components/AnimatedWidth.tsx
+++ b/apps/web/src/components/AnimatedWidth.tsx
@@ -13,6 +13,7 @@ export function AnimatedWidth({
const contentRef = useRef<HTMLSpanElement>(null);
const [width, setWidth] = useState<number | null>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes the content element's width before paint to animate width
useLayoutEffect(() => {
const element = contentRef.current;
if (!element) return;
diff --git a/apps/web/src/components/AppSidebarLayout.tsx b/apps/web/src/components/AppSidebarLayout.tsx
index 383c6b3123e..befbcf9f871 100644
--- a/apps/web/src/components/AppSidebarLayout.tsx
+++ b/apps/web/src/components/AppSidebarLayout.tsx
@@ -295,6 +295,7 @@ function SidebarControl() {
context: { usagePageOpen },
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window keydown listener that toggles the sidebar on its shortcut
useEffect(() => {
const onKeyDown = (event: KeyboardEvent) => {
if (event.defaultPrevented) return;
diff --git a/apps/web/src/components/BranchToolbarBranchSelector.tsx b/apps/web/src/components/BranchToolbarBranchSelector.tsx
index 8a55b276a64..ef842f21c44 100644
--- a/apps/web/src/components/BranchToolbarBranchSelector.tsx
+++ b/apps/web/src/components/BranchToolbarBranchSelector.tsx
@@ -484,6 +484,7 @@ export function BranchToolbarBranchSelector({
// The server sets started threads' branches; defaulting here would detach the agent from its worktree.
const threadStarted = serverSession !== null;
+ // 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
useEffect(() => {
if (
threadStarted ||
diff --git a/apps/web/src/components/ChatMarkdown.tsx b/apps/web/src/components/ChatMarkdown.tsx
index 8831ec98e22..0e9d8b762bf 100644
--- a/apps/web/src/components/ChatMarkdown.tsx
+++ b/apps/web/src/components/ChatMarkdown.tsx
@@ -477,6 +477,7 @@ function useChatMarkdownState({
setLocalMedia(null);
}
// Layout cleanup blocks stale requests from reaching onImageExpand before paint.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- layout cleanup invalidates media requests still loading for the old scope before paint
useLayoutEffect(
() => () => {
mediaRequestId.current += 1;
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx
index 4e6a9918792..927b9a8e44a 100644
--- a/apps/web/src/components/ChatView.tsx
+++ b/apps/web/src/components/ChatView.tsx
@@ -416,6 +416,7 @@ export default function ChatView(props: ChatViewProps) {
const routeThreadRef = scopeThreadRef(environmentId, threadId);
const routeThreadKey = scopedThreadKey(routeThreadRef);
const currentRouteThreadKeyRef = useRef<string | null>(routeThreadKey);
+ // 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
useLayoutEffect(() => {
currentRouteThreadKeyRef.current = routeThreadKey;
return () => {
@@ -675,6 +676,7 @@ export default function ChatView(props: ChatViewProps) {
setIsWorkspaceFileDragActive(false);
}
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window dragend listener that clears the workspace file drag state
useEffect(() => {
if (!isWorkspaceFileDragActive) return;
const clearWorkspaceFileDrag = () => setIsWorkspaceFileDragActive(false);
@@ -980,6 +982,7 @@ export default function ChatView(props: ChatViewProps) {
);
const diffOpen = activeRightPanelKind === "diff";
const explicitDiffOpenRef = useRef<ScopedThreadRef | null>(null);
+ // 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
useLayoutEffect(() => {
const explicitThreadRef = explicitDiffOpenRef.current;
explicitDiffOpenRef.current = null;
@@ -1103,6 +1106,7 @@ export default function ChatView(props: ChatViewProps) {
const handleFilePendingChangeStable = useStableCallback(handleFilePendingChange);
const configuredPreviewUrls = getConfiguredPreviewUrls(activeProjectScripts);
+ // 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
useEffect(() => {
if (!activeThreadRef || !activeEnvironmentBootstrapComplete) return;
useRightPanelStore.getState().reconcileFileSurfaces(activeThreadRef, activeProject !== null);
@@ -1618,6 +1622,7 @@ export default function ChatView(props: ChatViewProps) {
payload: { answers: request.answers },
})),
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- persists the server-reported resume compaction dismissal to localStorage
useEffect(() => {
if (nativeResumeCompactionDismissed && !resumeCompactionPermanentlyDismissed) {
setResumeCompactionPermanentlyDismissed(true);
@@ -1647,6 +1652,7 @@ export default function ChatView(props: ChatViewProps) {
const activeTerminalLaunchContext =
terminalUiLaunchContext?.threadId === activeThreadId ? terminalUiLaunchContext : null;
const liveIsGitRepo = gitStatusQuery.data?.isRepo;
+ // 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
useEffect(() => {
if (gitStatusCwd !== null && liveIsGitRepo !== undefined) {
rememberCheckoutIsRepo(environmentId, gitStatusCwd, liveIsGitRepo);
@@ -1777,6 +1783,7 @@ export default function ChatView(props: ChatViewProps) {
}
};
const onInterruptStable = useStableCallback(onInterrupt);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window listener for the desktop snapshot event that focuses the composer
useEffect(() => subscribeSnapShotComposerFocus(focusComposerStable), [focusComposerStable]);
const scheduleComposerFocus = () => {
window.requestAnimationFrame(() => {
@@ -1954,6 +1961,7 @@ export default function ChatView(props: ChatViewProps) {
visiblePullRequestCount,
onDiffPanelOpen,
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- consumes a pending maximize request from the right panel store once the panel can maximize
useEffect(() => {
if (!canMaximizeRightPanel) return;
if (useRightPanelStore.getState().consumeMaximizeRequest(routeThreadRef)) {
@@ -2068,6 +2076,7 @@ export default function ChatView(props: ChatViewProps) {
setTimelineAnchor,
});
+ // 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
useEffect(() => {
if (!activeThread?.id || terminalUiState.terminalOpen) return;
const frame = window.requestAnimationFrame(() => {
@@ -2078,6 +2087,7 @@ export default function ChatView(props: ChatViewProps) {
};
}, [activeThread?.id, focusComposerStable, terminalUiState.terminalOpen]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window focus listener that refocuses the composer after the window regains focus
useEffect(() => {
if (!activeThread?.id || terminalUiState.terminalOpen || isMobileViewport) return;
let frame: number | null = null;
@@ -2235,6 +2245,7 @@ export default function ChatView(props: ChatViewProps) {
composerRestingRef.current = resting;
};
const onComposerRestingChangeStable = useStableCallback(onComposerRestingChange);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the composer overlay element before paint for a new thread or composer mount
useLayoutEffect(() => {
if (!composerOverlayElement) return;
composerTimelineInsetRef.current = 0;
@@ -2249,6 +2260,7 @@ export default function ChatView(props: ChatViewProps) {
publishComposerOverlayHeightStable,
]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes the composer overlay element's size before paint and publishes its height
useLayoutEffect(() => {
if (!composerOverlayElement) return;
@@ -2578,6 +2590,7 @@ export default function ChatView(props: ChatViewProps) {
// Entering a thread with its drawer open focuses the drawer terminal; opening
// it from a handler requests focus there. A closed drawer leaves focus to the
// composer effect above.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- focuses the open drawer terminal when entering a thread
useEffect(() => {
if (activeThreadRef) return focusTerminalOnThreadEnter(activeThreadRef);
}, [activeThreadRef]);
@@ -2657,6 +2670,7 @@ export default function ChatView(props: ChatViewProps) {
});
// A focused desktop browser page forwards these chords as menu actions.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to desktop bridge menu actions that toggle the right panel
useEffect(() => {
return window.desktopBridge?.onMenuAction((action) => {
if (action === "rightPanel.toggle") toggleRightPanelStable();
@@ -2870,6 +2884,7 @@ export default function ChatView(props: ChatViewProps) {
threadKey: routeThreadKey,
key: pendingGuestMessageKey,
});
+ // 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
useEffect(() => {
const previous = previousPendingGuestMessagesRef.current;
previousPendingGuestMessagesRef.current = {
@@ -2930,6 +2945,7 @@ export default function ChatView(props: ChatViewProps) {
!activeEnvironmentUnavailable &&
!activePendingProgress &&
!feedbackUploading;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- switches the draft to local mode, then resends the waiting message once sending is idle
useEffect(() => {
if (
!workLocallyResendReady ||
@@ -3023,6 +3039,7 @@ export default function ChatView(props: ChatViewProps) {
const consumePendingFileDrop = useSidebarPendingFileDropStore(
(state) => state.consumePendingFileDrop,
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- hands pending sidebar file drops to the composer's imperative API once it mounts
useEffect(() => {
if (pendingSidebarFileDrops.length === 0) return;
if (
diff --git a/apps/web/src/components/CommandPalette.tsx b/apps/web/src/components/CommandPalette.tsx
index 5fbd9b4eaa2..a74736bfc59 100644
--- a/apps/web/src/components/CommandPalette.tsx
+++ b/apps/web/src/components/CommandPalette.tsx
@@ -702,6 +702,7 @@ function OpenCommandPaletteDialog(props: {
});
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- invalidates the browse navigation coordinator and in-flight clone lookups when the palette session unmounts
useEffect(
() => () => {
browseNavigation.invalidate();
diff --git a/apps/web/src/components/ComposerPromptEditorTiptap.tsx b/apps/web/src/components/ComposerPromptEditorTiptap.tsx
index c08182e359d..abc9549ee3d 100644
--- a/apps/web/src/components/ComposerPromptEditorTiptap.tsx
+++ b/apps/web/src/components/ComposerPromptEditorTiptap.tsx
@@ -1445,11 +1445,13 @@ function ComposerPromptEditorTiptapInner(
[],
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes the disabled prop into the imperative Tiptap editor via setEditable
useEffect(() => {
editor?.setEditable(!disabled);
}, [disabled, editor]);
// Push attributes before layout measurements; Tiptap updates them later in a passive effect.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes DOM attributes into the ProseMirror view before layout measurements read them
useLayoutEffect(() => {
if (!editor?.isInitialized) return;
editor.view.setProps({ attributes: editorAttributes });
@@ -1510,6 +1512,7 @@ function ComposerPromptEditorTiptapInner(
// The one place the controlled value reaches the editor. Imperative handlers compare against
// the committed value, so it is recorded here even before the editor exists.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- writes the controlled value and cursor into the Tiptap document before paint
useLayoutEffect(() => {
latestValueRef.current = value;
if (!editor) return;
@@ -1594,6 +1597,7 @@ function ComposerPromptEditorTiptapInner(
]);
// Reconcile loaded or switched provider skills without rebuilding citation node views.
+ // 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
useEffect(() => {
if (!editor || literalText) return;
const replacements = skillChipReplacements(editor.state.doc, (name) =>
@@ -1602,6 +1606,7 @@ function ComposerPromptEditorTiptapInner(
if (replacements.length > 0) replaceSkillChips(editor, replacements);
}, [editor, literalText, skills]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- restores ProseMirror focus and caret scroll when the keyed editor remounts, capturing focus on teardown
useLayoutEffect(() => {
if (!editor) return;
if (restoreFocusRef.current) {
diff --git a/apps/web/src/components/CustomSnoozeDialog.tsx b/apps/web/src/components/CustomSnoozeDialog.tsx
index 74414dc5f1e..efbc5d90da6 100644
--- a/apps/web/src/components/CustomSnoozeDialog.tsx
+++ b/apps/web/src/components/CustomSnoozeDialog.tsx
@@ -56,6 +56,7 @@ function startOfLocalDay(ms: number) {
export function CustomSnoozeDialogHost() {
const request = useRequest((state) => state.request);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- resolves any pending snooze request promise with null when the dialog host unmounts
useEffect(() => () => finish(null), []);
return request ? <CustomSnoozeDialog /> : null;
}
diff --git a/apps/web/src/components/DiffPanel.tsx b/apps/web/src/components/DiffPanel.tsx
index 9ade0b59c2b..02275c536c2 100644
--- a/apps/web/src/components/DiffPanel.tsx
+++ b/apps/web/src/components/DiffPanel.tsx
@@ -261,6 +261,7 @@ export default function DiffPanel({
return right.completedAt.localeCompare(left.completedAt);
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- rewrites the persisted diff store selection to the latest turn when the selected turn disappears
useEffect(() => {
if (!routeThreadRef || diffSelection.kind !== "turn") return;
useDiffPanelStore.getState().reconcileTurnSelection(
@@ -552,6 +553,7 @@ export default function DiffPanel({
// A file another view asked to reveal (a chat diff link): retried as the diff loads until it
// holds the file, then not again until a new request, so it does not undo what the user did since.
const externalRevealRef = useRef<string | null>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reveals an externally requested file in the diff viewer, retrying as the diff DOM loads
useEffect(() => {
if (!selectedFilePath) {
externalRevealRef.current = null;
diff --git a/apps/web/src/components/DiffWorkerPoolProvider.tsx b/apps/web/src/components/DiffWorkerPoolProvider.tsx
index e2384aaab95..a40d8e20c7b 100644
--- a/apps/web/src/components/DiffWorkerPoolProvider.tsx
+++ b/apps/web/src/components/DiffWorkerPoolProvider.tsx
@@ -94,6 +94,7 @@ function DiffWorkerReady({ children }: { children?: ReactNode }) {
? readyPool === workerPool || workerPool.isInitialized() || !workerPool.isWorkingPool()
: typeof window === "undefined";
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- initializes the diff worker pool and marks it ready when its async startup settles
useEffect(() => {
if (ready || !workerPool) return;
diff --git a/apps/web/src/components/GitActionsControl.tsx b/apps/web/src/components/GitActionsControl.tsx
index 61ff760c45b..d3083f74649 100644
--- a/apps/web/src/components/GitActionsControl.tsx
+++ b/apps/web/src/components/GitActionsControl.tsx
@@ -1107,6 +1107,7 @@ export default function GitActionsControl({
activeDraftThread?.envMode === "worktree" &&
activeDraftThread.worktreePath === null;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- persists the draft thread branch when the live git status subscription reports a different branch
useEffect(() => {
if (isGitActionRunning || isSelectingWorktreeBase || activeServerThread) {
return;
diff --git a/apps/web/src/components/LegacySidebar.tsx b/apps/web/src/components/LegacySidebar.tsx
index 05422aa57c5..6d54fe2b7b9 100644
--- a/apps/web/src/components/LegacySidebar.tsx
+++ b/apps/web/src/components/LegacySidebar.tsx
@@ -3504,6 +3504,7 @@ export default function LegacySidebar({ routeReveal }: { routeReveal: SidebarRou
event.stopPropagation();
navigateToThread(scopeThreadRef(targetThread.environmentId, targetThread.id));
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to window keydown for thread navigation shortcuts for the sidebar's lifetime
useEffect(() => {
const handleWindowKeyDown = (event: globalThis.KeyboardEvent) => onWindowKeyDown(event);
window.addEventListener("keydown", handleWindowKeyDown);
@@ -3512,6 +3513,7 @@ export default function LegacySidebar({ routeReveal }: { routeReveal: SidebarRou
};
}, []);
// A window listener whose lifetime is the sidebar's: no element owns outside clicks.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window mousedown listener that clears thread selection on outside clicks for the sidebar's lifetime
useEffect(() => {
window.addEventListener("mousedown", clearThreadSelectionOnOutsideMouseDown);
return () => window.removeEventListener("mousedown", clearThreadSelectionOnOutsideMouseDown);
diff --git a/apps/web/src/components/PersistentThreadTerminals.tsx b/apps/web/src/components/PersistentThreadTerminals.tsx
index dab0f16969a..5e2fe0dbe91 100644
--- a/apps/web/src/components/PersistentThreadTerminals.tsx
+++ b/apps/web/src/components/PersistentThreadTerminals.tsx
@@ -162,6 +162,7 @@ export const PersistentThreadTerminalDrawer = memo(function PersistentThreadTerm
const storeCloseTerminal = useTerminalUiStateStore((state) => state.closeTerminal);
const reconcileTerminalIds = useTerminalUiStateStore((state) => state.reconcileTerminalIds);
+ // 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
useEffect(() => {
if (terminalIdListsEqual(serverOrderedTerminalIds, terminalUiState.terminalIds)) {
return;
diff --git a/apps/web/src/components/ProjectCloneToastCoordinator.tsx b/apps/web/src/components/ProjectCloneToastCoordinator.tsx
index 79c927d6e2d..8832a444f37 100644
--- a/apps/web/src/components/ProjectCloneToastCoordinator.tsx
+++ b/apps/web/src/components/ProjectCloneToastCoordinator.tsx
@@ -88,6 +88,7 @@ function EnvironmentCloneToasts({ environmentId }: { environmentId: EnvironmentI
void handleNewThread(scopeProjectRef(environmentId, projectId));
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens, updates and closes imperative toastManager toasts to match the current project clones
useEffect(() => {
const seen = new Set<ProjectId>();
for (const clone of clones) {
@@ -215,6 +216,7 @@ function EnvironmentCloneToasts({ environmentId }: { environmentId: EnvironmentI
retryClone,
]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- closes every tracked clone toast in toastManager when the coordinator unmounts
useEffect(
() => () => {
for (const tracked of toasts.current.values()) toastManager.close(tracked.toastId);
diff --git a/apps/web/src/components/ReopenClosedViewShortcut.tsx b/apps/web/src/components/ReopenClosedViewShortcut.tsx
index eb7f9866919..f409ce48bfe 100644
--- a/apps/web/src/components/ReopenClosedViewShortcut.tsx
+++ b/apps/web/src/components/ReopenClosedViewShortcut.tsx
@@ -144,6 +144,7 @@ export function ReopenClosedViewShortcut() {
});
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to window keydown and the desktop menu action for the reopen closed view shortcut
useEffect(() => {
const onKeyDown = (event: KeyboardEvent) => {
if (
@@ -178,6 +179,7 @@ export function ReopenClosedViewShortcut() {
};
}, [keybindings, previewOpen, terminalOpen]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- registers forwarded shortcut chords with the desktop preview bridge and clears them on cleanup
useEffect(() => {
const preview = window.desktopBridge?.preview;
if (!preview?.setForwardedShortcuts) return;
diff --git a/apps/web/src/components/RightPanelTabs.tsx b/apps/web/src/components/RightPanelTabs.tsx
index 4cab22ef838..b833eec279d 100644
--- a/apps/web/src/components/RightPanelTabs.tsx
+++ b/apps/web/src/components/RightPanelTabs.tsx
@@ -389,6 +389,7 @@ function RightPanelEmptyState(props: {
event.stopPropagation();
action.onClick();
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes a capture-phase window keydown listener for surface shortcuts while the menu is mounted
useEffect(() => {
const handler = (event: KeyboardEvent) => handleShortcut(event);
window.addEventListener("keydown", handler, true);
@@ -975,6 +976,7 @@ export function RightPanelTabs(props: RightPanelTabsProps) {
setAddSurfaceMenuOpen(true);
}
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes a document keydown listener for the new surface shortcut while the panel is open
useEffect(() => {
if (props.open === false) return;
document.addEventListener("keydown", onNewSurfaceKeyDown, true);
@@ -1181,6 +1183,7 @@ export function RightPanelTabs(props: RightPanelTabsProps) {
});
// A newly active tab, or tabs that start overflowing, can sit outside the scrolled strip.
+ // 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
useEffect(() => {
if (!props.activeSurfaceId || !tabScrollState.hasOverflow) return;
const activeTab = tabListRef.current?.querySelector<HTMLElement>("[data-active-tab='true']");
diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx
index 748b006b380..f4ec80f8c5f 100644
--- a/apps/web/src/components/Sidebar.tsx
+++ b/apps/web/src/components/Sidebar.tsx
@@ -1018,6 +1018,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
// scope. Route changes arrive from history, links and the palette, and only this
// component holds the project groups that decide a widening, so no single
// navigation handler can make the write.
+ // 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
useEffect(() => {
if (!revealWidensScope) return;
clearSelection();
@@ -1447,6 +1448,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
}
})();
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- registers this sidebar's settle handler in the module-level settleAndAdvance registry
useEffect(() => registerSettleAndAdvance(attemptSettle), [attemptSettle]);
const settleThreads = (threadKeys: readonly string[]) => {
const coSettlingKeys = new Set(threadKeys);
@@ -1572,6 +1574,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
};
const dndSensors = useSensors(useSensor(SidebarPointerSensor, pointerSensorOptions));
const sectionByThreadKeyRef = useRef(sectionByThreadKey);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes committed list data to refs read by stable drag and sweep callbacks
useLayoutEffect(() => {
projectGroupsRef.current = projectGroups;
orderedThreadKeysRef.current = orderedThreadKeys;
@@ -1760,6 +1763,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
// Update the local list too; threadByKey already omits rows moved into collapsed shelves.
sidebarListItems = sidebarListItemsFresh;
}
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the dnd-kit drag sensor when the dragged row leaves the list
useEffect(() => {
if (
dragState !== null &&
@@ -1778,6 +1782,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
dragState === null && sidebarListItems.length + visibleDraftSessionCount > 0;
// Cache on both fields so layout-key changes trigger the effect even when animate is unchanged.
const listMotionPass = { layoutKey: listMotionLayoutKey, animate: listMotionAnimate };
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- tells the list motion controller to animate or not after each layout-affecting commit
useLayoutEffect(() => {
listMotionRef.current?.update(listMotionPass.animate);
}, [listMotionPass]);
@@ -2622,6 +2627,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
? selectThreadTerminalUiState(state.terminalUiStateByThreadKey, routeThreadRef).terminalOpen
: false,
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to window keydown for thread navigation shortcuts using the current thread list
useEffect(() => {
const onWindowKeyDown = (event: KeyboardEvent) => {
if (event.defaultPrevented || event.repeat || isCommandPaletteOpen() || isModelPickerOpen()) {
diff --git a/apps/web/src/components/ThreadRouteView.tsx b/apps/web/src/components/ThreadRouteView.tsx
index 30ee70d0dd6..79f4633ea54 100644
--- a/apps/web/src/components/ThreadRouteView.tsx
+++ b/apps/web/src/components/ThreadRouteView.tsx
@@ -89,6 +89,7 @@ export function ThreadRouteView({
});
const environmentHasAnyThreads = environmentThreadRefs.length > 0 || environmentHasDraftThreads;
+ // 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
useEffect(() => {
if (target.kind !== "server" || !bootstrapComplete) {
return;
diff --git a/apps/web/src/components/ThreadTerminalDrawer.tsx b/apps/web/src/components/ThreadTerminalDrawer.tsx
index 301255c7d51..6bb6dc551c1 100644
--- a/apps/web/src/components/ThreadTerminalDrawer.tsx
+++ b/apps/web/src/components/ThreadTerminalDrawer.tsx
@@ -616,6 +616,7 @@ function TerminalSessionViewport({
openTerminalLinkInPreview({ url, threadRef, openPreview, fallbackToBrowser, forceBrowser }),
);
+ // 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
useLayoutEffect(() => {
if (terminalRef.current) terminalRef.current.input.readOnly = !canOperateTerminal;
if (canOperateTerminal && visibleRef.current)
@@ -624,12 +625,14 @@ function TerminalSessionViewport({
// Links re-read the grant on activation; only the hovered link's styling needs a nudge.
const linkActivationScopeRef = useRef(canOpenHostEditor);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- refreshes link activation styling on the imperative terminal surface when the editor grant changes
useEffect(() => {
if (linkActivationScopeRef.current === canOpenHostEditor) return;
linkActivationScopeRef.current = canOpenHostEditor;
terminalRef.current?.refreshLinkActivation();
}, [canOpenHostEditor]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes visibility into the terminal surface before paint and consumes focus requests made while hidden
useLayoutEffect(() => {
visibleRef.current = visible;
terminalRef.current?.setVisible(visible);
@@ -637,6 +640,7 @@ function TerminalSessionViewport({
if (visible) consumePendingTerminalFocus(threadRef, terminalId);
}, [terminalId, threadRef, visible]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- applies font family and size changes to the live Ghostty terminal surface
useEffect(() => {
const current = terminalFontRef.current;
if (current.family === terminalFontFamily && current.size === terminalFontSize) return;
@@ -644,6 +648,7 @@ function TerminalSessionViewport({
void terminalRef.current?.setFont(terminalFontOptions(terminalFontFamily, terminalFontSize));
}, [terminalFontFamily, terminalFontSize]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- creates the Ghostty terminal in the mount node and subscribes it to the terminal session
useEffect(() => {
const mount = containerRef.current;
if (!mount) return;
@@ -1690,6 +1695,7 @@ export default function ThreadTerminalDrawer({
if (heightBudgetChanged) setDrawerLayout(layout);
},
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the drawer before visible paint and observes window and chat column resizes while visible
useLayoutEffect(() => {
if (!visible) {
return;
diff --git a/apps/web/src/components/auth/ConnectAgentSurface.tsx b/apps/web/src/components/auth/ConnectAgentSurface.tsx
index 86481902553..fae971b3731 100644
--- a/apps/web/src/components/auth/ConnectAgentSurface.tsx
+++ b/apps/web/src/components/auth/ConnectAgentSurface.tsx
@@ -93,6 +93,7 @@ export function ConnectAgentSurface() {
const [errorMessage, setErrorMessage] = useState("");
const [pending, setPending] = useState<"approve" | "deny" | null>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- fetches the MCP OAuth approval and redirects the window or stores details, ignoring stale answers
useEffect(() => {
let cancelled = false;
void runApproval((client) => client.mcpOAuth.approval({ payload: authorization })).then(
diff --git a/apps/web/src/components/auth/PairingRouteSurface.tsx b/apps/web/src/components/auth/PairingRouteSurface.tsx
index 926260af8e4..8bedc8b2e71 100644
--- a/apps/web/src/components/auth/PairingRouteSurface.tsx
+++ b/apps/web/src/components/auth/PairingRouteSurface.tsx
@@ -71,6 +71,7 @@ export function PairingRouteSurface({
void submitCredential(token);
});
+ // 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
useEffect(() => {
if (!autoPairToken || autoSubmitAttemptedRef.current) {
return;
@@ -194,6 +195,7 @@ export function HostedPairingRouteSurface() {
void submitHostedPairingRequest();
});
+ // 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
useEffect(() => {
if (submitAttemptedRef.current) {
return;
diff --git a/apps/web/src/components/chat/AssistantCitationChip.tsx b/apps/web/src/components/chat/AssistantCitationChip.tsx
index 1e97f00319c..cbe5ad8cddb 100644
--- a/apps/web/src/components/chat/AssistantCitationChip.tsx
+++ b/apps/web/src/components/chat/AssistantCitationChip.tsx
@@ -59,6 +59,7 @@ export function AssistantCitationChip({
const commentOpen = commentEditor?.open ?? false;
const sourceAnchor = commentEditor?.sourceAnchor;
const activeSourceAnchor = sourceAnchor === unavailableSourceAnchor ? undefined : sourceAnchor;
+ // 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
useEffect(() => {
if (!commentOpen) draftCommentRef.current = null;
}, [commentOpen]);
@@ -79,6 +80,7 @@ export function AssistantCitationChip({
setUnavailableSourceAnchor(sourceAnchor);
}
});
+ // 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
useEffect(() => {
if (!commentOpen || sourceAnchor === unavailableSourceAnchor) return;
const anchor = sourceAnchor ?? findAssistantCitationSourceAnchor(document, citation);
diff --git a/apps/web/src/components/chat/AssistantCitationSource.tsx b/apps/web/src/components/chat/AssistantCitationSource.tsx
index 463bf4197b1..ad04cb1fdf7 100644
--- a/apps/web/src/components/chat/AssistantCitationSource.tsx
+++ b/apps/web/src/components/chat/AssistantCitationSource.tsx
@@ -348,6 +348,7 @@ export function AssistantCitationSource({
children: ReactNode;
}) {
const rootRef = useRef<HTMLDivElement>(null);
+ // 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
useEffect(() => {
const root = rootRef.current;
const list = listRef.current;
diff --git a/apps/web/src/components/chat/AssistantSelectionToolbar.tsx b/apps/web/src/components/chat/AssistantSelectionToolbar.tsx
index ea27de728e1..9280b9cbc06 100644
--- a/apps/web/src/components/chat/AssistantSelectionToolbar.tsx
+++ b/apps/web/src/components/chat/AssistantSelectionToolbar.tsx
@@ -36,6 +36,7 @@ export function AssistantSelectionToolbar({
const toolbarRef = useRef<HTMLButtonElement>(null);
const actionsRef = useRef<ReturnType<typeof observeSelectionActions> | null>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the toolbar DOM node and clamps its position inside the window before paint
useLayoutEffect(() => {
const toolbar = toolbarRef.current;
if (!toolbar || !selection) return;
@@ -44,6 +45,7 @@ export function AssistantSelectionToolbar({
toolbar.style.top = `${Math.max(8, Math.min(selection.position.y, window.innerHeight - rect.height - 8))}px`;
}, [selection]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to document selectionchange and keydown to track text selections in the viewport
useEffect(() => {
if (!viewport) return;
const clear = () => setSelection(null);
diff --git a/apps/web/src/components/chat/ChangedFilesTree.tsx b/apps/web/src/components/chat/ChangedFilesTree.tsx
index ce56a017374..ca10db64502 100644
--- a/apps/web/src/components/chat/ChangedFilesTree.tsx
+++ b/apps/web/src/components/chat/ChangedFilesTree.tsx
@@ -261,6 +261,7 @@ function ChangedFilesRows({
const [range, setRange] = useState({ start: 0, end: 40, rowHeight: 28 });
const [focusedPath, setFocusedPath] = useState<string | null>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes scroll, window resize and ancestor resizes to compute the virtualized row range
useLayoutEffect(() => {
const container = containerRef.current;
const rowSize = rowSizeRef.current;
diff --git a/apps/web/src/components/chat/ChatCanvas.tsx b/apps/web/src/components/chat/ChatCanvas.tsx
index bdcff99e6c2..e05d3befcc1 100644
--- a/apps/web/src/components/chat/ChatCanvas.tsx
+++ b/apps/web/src/components/chat/ChatCanvas.tsx
@@ -29,6 +29,7 @@ export function ChatCanvas({
const [timelineElement, registerTimeline] = useState<HTMLElement | null>(null);
const measurements = useStore(store, (state) => state.measurements);
const detailsCardMeasurement = useStore(store, (state) => state.detailsCardMeasurement);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes canvas, find bar and timeline resizes and writes the measurements to the canvas store
useLayoutEffect(() => {
const element = elementRef.current;
const probe = widthProbeRef.current;
diff --git a/apps/web/src/components/chat/ChatComposer.tsx b/apps/web/src/components/chat/ChatComposer.tsx
index 1d17f03e41b..71a93bf86b2 100644
--- a/apps/web/src/components/chat/ChatComposer.tsx
+++ b/apps/web/src/components/chat/ChatComposer.tsx
@@ -653,6 +653,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
const isEditingQueuedMessage = editingQueuedAttachments !== null;
const composerDraft = useComposerThreadDraft(composerDraftTarget);
const composerDraftTargetKeyRef = useRef("");
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes the committed draft target key to a ref read by async handlers
useLayoutEffect(() => {
composerDraftTargetKeyRef.current = composerDraftTargetKey;
});
@@ -673,6 +674,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
!activePendingIsResponding;
const questionRequest = pendingUserInputs[0];
// Publish eligibility before async captures can observe a question the UI has already closed.
+ // 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
useLayoutEffect(() => {
if (!questionAttachmentTarget || !questionRequest || !questionTakesSnapShots) return;
return trackOpenQuestionAttachmentDraft(routeThreadRef, {
@@ -697,6 +699,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
const attachmentTargetKey = composerTargetKey(attachmentDraftTarget);
// Reject async imports after a draft switch.
const attachmentTargetKeyRef = useRef(attachmentTargetKey);
+ // 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
useLayoutEffect(() => {
attachmentTargetKeyRef.current = attachmentTargetKey;
});
@@ -837,6 +840,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
);
const getComposerDraft = useComposerDraftStore((store) => store.getComposerDraft);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- starts or releases server attachment uploads as upload capability, limits and draft attachments change
useEffect(() => {
if (!attachmentUploadsCapabilityKnown) {
return;
@@ -1079,10 +1083,12 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
const composerScrollGestureRef = useRef(createComposerScrollGestureState());
const pendingThreadImportsRef = useRef<Map<string, number>>(new Map());
const isRevertingCheckpointRef = useRef(isRevertingCheckpoint);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes the committed checkpoint revert flag to a ref read by async handlers
useLayoutEffect(() => {
isRevertingCheckpointRef.current = isRevertingCheckpoint;
});
+ // 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
useEffect(() => {
const armPasteAsTextShortcut = () => {
// Electron's menu action can precede paste; browsers deliver keydown first.
@@ -1175,6 +1181,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
const activeComposerMenuItem =
composerMenuItems.find((item) => item.id === activeComposerMenuItemId) ?? null;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes committed composer menu state to refs read by editor key handlers
useLayoutEffect(() => {
composerMenuOpenRef.current = composerMenuOpen;
composerMenuItemsRef.current = composerMenuItems;
@@ -1395,6 +1402,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
addComposerFilesToDraft,
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- keeps the shared prompt ref in step with the committed draft prompt for imperative handlers
useEffect(() => {
if (isLiteralPendingAnswer) return;
promptRef.current = prompt;
@@ -1432,14 +1440,17 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
setProviderInputSubmissionError(null);
}
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- keeps the shared images ref in step with committed draft images for async handlers
useEffect(() => {
composerImagesRef.current = composerImages;
}, [composerImages, composerImagesRef]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- keeps the shared files ref in step with committed draft files for async handlers
useEffect(() => {
composerFilesRef.current = composerFiles;
}, [composerFiles, composerFilesRef]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- keeps the shared terminal contexts ref in step with committed draft contexts for async handlers
useEffect(() => {
composerTerminalContextsRef.current = composerTerminalContexts;
}, [composerTerminalContexts, composerTerminalContextsRef]);
@@ -1458,6 +1469,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
questionId: string | null;
} | null>(null);
+ // 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
useEffect(() => {
const nextCustomAnswer = activePendingProgress?.customAnswer;
if (typeof nextCustomAnswer !== "string") {
@@ -1521,6 +1533,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
setIsComposerScrollCollapsed(false);
}
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes composer form resizes to switch the footer and primary actions between compact layouts
useLayoutEffect(() => {
const composerForm = composerFormRef.current;
if (!composerForm) return;
@@ -1557,6 +1570,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
});
}, [composerFooterHasWideActions]);
+ // 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
useEffect(() => {
let cancelled = false;
void (async () => {
@@ -2354,14 +2368,17 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
if (composerControlsHidden && isComposerModelPickerOpen) {
setIsComposerModelPickerOpen(false);
}
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reports whether resting controls show in the strip to ChatView before paint
useLayoutEffect(() => {
onRestingControlsVisibilityChange(composerControlsVisibleInStrip);
}, [composerControlsVisibleInStrip, onRestingControlsVisibilityChange]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reports the resting state to ChatView's ref before paint
useLayoutEffect(() => {
onRestingChange(isComposerResting);
}, [isComposerResting, onRestingChange]);
const [restingActionsElement, setRestingActionsElement] = useState<HTMLDivElement | null>(null);
const [restingActionsWidth, setRestingActionsWidth] = useState<number | null>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes resizes of the resting actions DOM node to measure its width
useLayoutEffect(() => {
if (!isComposerResting || !restingActionsElement) return;
const measure = () => setRestingActionsWidth(restingActionsElement.offsetWidth);
@@ -2410,11 +2427,13 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
setIsComposerScrollCollapsed(false);
}
const composerScrollCollapseEligible = canScrollCollapseComposer && !isComposerResting;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes the committed scroll-collapse eligibility to a ref read by the wheel listener
useLayoutEffect(() => {
composerScrollCollapseEligibleRef.current = composerScrollCollapseEligible;
});
// Window activation re-fires focus; ignore that frame to keep the composer collapsed.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window focus listener and animation frame that ignore activation focus while the composer is collapsed
useEffect(() => {
if (!isComposerScrollCollapsed) return;
let frame: number | null = null;
@@ -2434,6 +2453,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
};
}, [isComposerScrollCollapsed]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes a capture-phase document wheel listener that collapses the composer on timeline scroll
useEffect(() => {
if (!canTrackComposerScrollGesture) return;
@@ -2772,6 +2792,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
const setContextInsertionHandler = useComposerDraftStore(
(store) => store.setContextInsertionHandler,
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- registers this composer's context insertion handler in the draft store for the current target
useEffect(() => {
return setContextInsertionHandler(composerDraftTarget, insertContextReferencesAtCaretStable);
}, [composerDraftTarget, insertContextReferencesAtCaretStable, setContextInsertionHandler]);
@@ -2914,6 +2935,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
};
// Escape can cancel without dragleave; clear highlights on bubbling dragend.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window dragend listener clears the drop highlight when a drag is cancelled without dragleave
useEffect(() => {
if (!isDragOverComposer) return;
const onWindowDragEnd = () => {
@@ -2964,11 +2986,13 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
// Question dismissal unmounts focused controls without firing blur.
const activePendingUserInputRequestId = activePendingUserInput?.requestId ?? null;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- schedules the collapse check after a dismissed question unmounts focused controls without a blur
useEffect(() => {
if (activePendingUserInputRequestId !== null) return;
scheduleComposerCollapseCheckStable();
}, [activePendingUserInputRequestId, scheduleComposerCollapseCheckStable]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels pending blur and mobile expand animation frames when the composer unmounts
useEffect(() => {
return () => {
if (composerBlurFrameRef.current !== null) {
diff --git a/apps/web/src/components/chat/ChatHeader.tsx b/apps/web/src/components/chat/ChatHeader.tsx
index 116eed2c066..ec92540efd1 100644
--- a/apps/web/src/components/chat/ChatHeader.tsx
+++ b/apps/web/src/components/chat/ChatHeader.tsx
@@ -115,6 +115,7 @@ export const ChatHeader = memo(function ChatHeader({
? renaming.title
: null;
const isRenamingTitle = renamingTitle !== null;
+ // 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
useEffect(() => {
const list = breadcrumbContainerRef.current?.querySelector("ol");
if (!list || !parentThreadLink) return;
@@ -204,6 +205,7 @@ export const ChatHeader = memo(function ChatHeader({
clearTimeout(titleMenuTimerRef.current);
titleMenuTimerRef.current = null;
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the pending title-menu timer when the thread switches or the header unmounts
useEffect(
() => () => {
if (titleMenuTimerRef.current === null) return;
diff --git a/apps/web/src/components/chat/CommandOutputPanel.tsx b/apps/web/src/components/chat/CommandOutputPanel.tsx
index 4e698fc854a..3ee07088519 100644
--- a/apps/web/src/components/chat/CommandOutputPanel.tsx
+++ b/apps/web/src/components/chat/CommandOutputPanel.tsx
@@ -40,6 +40,7 @@ export function CommandOutputPanel(props: {
const text = data?.output.text ?? "";
const { resolvedTheme } = useTheme();
+ // 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
useLayoutEffect(() => {
const element = scrollRef.current;
if (element && followRef.current) element.scrollTop = element.scrollHeight;
diff --git a/apps/web/src/components/chat/ComposerAttachmentStrip.tsx b/apps/web/src/components/chat/ComposerAttachmentStrip.tsx
index 1b2f572dfbd..2a0c0f7b1a1 100644
--- a/apps/web/src/components/chat/ComposerAttachmentStrip.tsx
+++ b/apps/web/src/components/chat/ComposerAttachmentStrip.tsx
@@ -81,6 +81,7 @@ function SnapShotAttachmentFrame({
}) {
const frameRef = useRef<HTMLDivElement>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the mounted tile into view and registers it as the SnapShot animation destination
useLayoutEffect(() => {
const frame = frameRef.current;
if (!frame || (!animationId && !arrival)) return;
diff --git a/apps/web/src/components/chat/ComposerBannerStack.tsx b/apps/web/src/components/chat/ComposerBannerStack.tsx
index 494f7562f63..086826cde86 100644
--- a/apps/web/src/components/chat/ComposerBannerStack.tsx
+++ b/apps/web/src/components/chat/ComposerBannerStack.tsx
@@ -62,6 +62,7 @@ export function NoticeText({
const detailsRef = useRef<HTMLButtonElement>(null);
const [showDetails, setShowDetails] = useState(false);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures text overflow in the DOM via ResizeObserver and MutationObserver to show the details button
useLayoutEffect(() => {
const text = textRef.current;
if (!text) return;
diff --git a/apps/web/src/components/chat/ComposerCommandMenu.tsx b/apps/web/src/components/chat/ComposerCommandMenu.tsx
index d2f224b3f5b..afa058587b5 100644
--- a/apps/web/src/components/chat/ComposerCommandMenu.tsx
+++ b/apps/web/src/components/chat/ComposerCommandMenu.tsx
@@ -103,6 +103,7 @@ export const ComposerCommandMenu = memo(function ComposerCommandMenu(props: {
}) {
const listRef = useRef<HTMLDivElement>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the highlighted menu item's DOM node into view
useLayoutEffect(() => {
if (!props.activeItemId || !listRef.current) return;
const el = listRef.current.querySelector<HTMLElement>(
diff --git a/apps/web/src/components/chat/ComposerCommandMenuLayer.tsx b/apps/web/src/components/chat/ComposerCommandMenuLayer.tsx
index a449fc6a442..109473eddca 100644
--- a/apps/web/src/components/chat/ComposerCommandMenuLayer.tsx
+++ b/apps/web/src/components/chat/ComposerCommandMenuLayer.tsx
@@ -24,6 +24,7 @@ export function ComposerCommandMenuLayer(props: {
}) {
const [position, setPosition] = useState<ComposerCommandMenuPosition | null>(null);
+ // 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
useLayoutEffect(() => {
const anchor = props.anchor;
if (!anchor) return;
diff --git a/apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx b/apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx
index 13d3d22aa88..697a0e0bfd6 100644
--- a/apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx
+++ b/apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx
@@ -115,6 +115,7 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard(
setOptimisticSingleSelect(null);
}
+ // 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
useEffect(() => {
const clearAutoAdvance = () => {
if (autoAdvanceTimerRef.current !== null) {
@@ -146,6 +147,7 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard(
const selectOptionFromShortcut = useEffectEvent(handleOptionSelection);
const backgroundThread = use(BackgroundThreadContext);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes a document keydown listener for digit shortcuts while a question is answerable
useEffect(() => {
if (!activeQuestion || responseDisabled || isCollapsed || backgroundThread) return;
const handler = (event: globalThis.KeyboardEvent) => {
diff --git a/apps/web/src/components/chat/ComposerStashMenu.tsx b/apps/web/src/components/chat/ComposerStashMenu.tsx
index 2f135cd1e34..a68bf9159b4 100644
--- a/apps/web/src/components/chat/ComposerStashMenu.tsx
+++ b/apps/web/src/components/chat/ComposerStashMenu.tsx
@@ -111,6 +111,7 @@ export const ComposerStashMenu = memo(function ComposerStashMenu(props: {
}
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes capture-phase pointerdown and keydown listeners for outside close and keyboard navigation
useEffect(() => {
const onPointerDown = (event: PointerEvent) => closeOnOutsidePointer(event);
const onKeyDown = (event: KeyboardEvent) => handleKeyDown(event);
diff --git a/apps/web/src/components/chat/DraftHeroProjectHeading.tsx b/apps/web/src/components/chat/DraftHeroProjectHeading.tsx
index a0c5754e71b..d5db58f503a 100644
--- a/apps/web/src/components/chat/DraftHeroProjectHeading.tsx
+++ b/apps/web/src/components/chat/DraftHeroProjectHeading.tsx
@@ -13,6 +13,7 @@ export function DraftHeroProjectHeading({
const inlineRef = useRef<HTMLSpanElement>(null);
const [fitsInline, setFitsInline] = useState(false);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the heading against its container via ResizeObserver to choose inline or stacked layout
useLayoutEffect(() => {
const container = containerRef.current;
const inline = inlineRef.current;
diff --git a/apps/web/src/components/chat/HtmlRenderFrame.tsx b/apps/web/src/components/chat/HtmlRenderFrame.tsx
index 19fbe6108ae..93764adecfe 100644
--- a/apps/web/src/components/chat/HtmlRenderFrame.tsx
+++ b/apps/web/src/components/chat/HtmlRenderFrame.tsx
@@ -59,6 +59,7 @@ export function HtmlRenderFrame(props: {
// Tied to the viewer's lifetime: unmounting while expanded must still release
// the timeline's follow pin, which a close handler alone never reaches.
const expanded = expandedSrc !== null;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- holds the parent's fullscreen pin while expanded and releases it on collapse or unmount
useEffect(() => {
if (!expanded) return;
onFullscreenChange?.(true);
diff --git a/apps/web/src/components/chat/MarkdownCodeBlock.tsx b/apps/web/src/components/chat/MarkdownCodeBlock.tsx
index 101c8a05d3e..6b1822aac14 100644
--- a/apps/web/src/components/chat/MarkdownCodeBlock.tsx
+++ b/apps/web/src/components/chat/MarkdownCodeBlock.tsx
@@ -331,6 +331,7 @@ function UncachedShikiCodeBlock({
const incrementalHighlight = preserveLines
? createIncrementalHighlightedDocument(highlighter, language, themeName)
: null;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- disposes the incremental Shiki highlighter when it is replaced or the block unmounts
useEffect(() => () => incrementalHighlight?.dispose(), [incrementalHighlight]);
const highlighted = (() => {
const result = (() => {
diff --git a/apps/web/src/components/chat/McpAppFrame.tsx b/apps/web/src/components/chat/McpAppFrame.tsx
index 430a6b74126..d65758f08d4 100644
--- a/apps/web/src/components/chat/McpAppFrame.tsx
+++ b/apps/web/src/components/chat/McpAppFrame.tsx
@@ -391,11 +391,13 @@ export function McpAppFrame(props: {
};
};
+ // 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
useEffect(() => {
hostRef.current?.updateHostContext();
// oxlint-disable-next-line react/exhaustive-effect-dependencies -- Context changes trigger a resend.
}, [theme, width, displayMode, toolDefinition]);
+ // 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
useEffect(() => {
if (toolCall !== undefined) hostRef.current?.setToolCall(toolCall);
// oxlint-disable-next-line react/exhaustive-effect-dependencies -- Each new document needs the call.
diff --git a/apps/web/src/components/chat/MessagesTimeline.tsx b/apps/web/src/components/chat/MessagesTimeline.tsx
index dfcdce4c557..07bc698e02c 100644
--- a/apps/web/src/components/chat/MessagesTimeline.tsx
+++ b/apps/web/src/components/chat/MessagesTimeline.tsx
@@ -151,7 +151,7 @@ function TimelineListFooter({
readonly children?: ReactNode;
}) {
const contentRef = useRef<HTMLDivElement>(null);
- // oxlint-disable-next-line t3code/react-effect-budget -- reports growth of the footer's content, which the list does not follow
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reports growth of the footer's content, which the list does not follow
useLayoutEffect(() => {
const content = contentRef.current;
if (!content || !onGrow) return;
@@ -704,6 +704,7 @@ const ConversationTimeline = memo(function ConversationTimeline({
// must land before paint, after LegendList's own layout effects applied the
// new data. A citation request that arrives mid-restore takes over.
const { findOpenAtOpening } = identityChanged ? { findOpenAtOpening: findOpen } : listState;
+ // 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
useLayoutEffect(() => {
const list = listRef.current;
const viewport = viewportRef.current;
diff --git a/apps/web/src/components/chat/ModelPickerContent.tsx b/apps/web/src/components/chat/ModelPickerContent.tsx
index 2f2c91bc4e8..b7430716f96 100644
--- a/apps/web/src/components/chat/ModelPickerContent.tsx
+++ b/apps/web/src/components/chat/ModelPickerContent.tsx
@@ -282,6 +282,7 @@ function ModelPickerList({
setShowBottomScrollFade(itemKeys.length > 5);
}
const measureScrollFades = useEffectEvent(updateScrollFades);
+ // 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
useLayoutEffect(() => {
let nestedFrame = 0;
const frame = window.requestAnimationFrame(() => {
@@ -332,6 +333,7 @@ function ModelPickerList({
// Capture gives picker shortcuts priority over the composer.
function WindowKeyDownListener({ onKeyDown }: { onKeyDown: (event: KeyboardEvent) => void }) {
const handleKeyDown = useEffectEvent(onKeyDown);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes a capture-phase window keydown listener for the picker's lifetime
useEffect(() => {
const listener = (event: KeyboardEvent) => handleKeyDown(event);
window.addEventListener("keydown", listener, true);
diff --git a/apps/web/src/components/chat/ModelPickerSidebar.tsx b/apps/web/src/components/chat/ModelPickerSidebar.tsx
index 0dca95cf02b..3d98646e04e 100644
--- a/apps/web/src/components/chat/ModelPickerSidebar.tsx
+++ b/apps/web/src/components/chat/ModelPickerSidebar.tsx
@@ -50,6 +50,7 @@ export const ModelPickerSidebar = memo(function ModelPickerSidebar(props: {
const [hoveredInstanceId, setHoveredInstanceId] = useState<ProviderInstanceId | null>(null);
const sidebarContentRef = useRef<HTMLDivElement>(null);
const [selectedIndicatorTop, setSelectedIndicatorTop] = useState<number | null>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reads the selected provider item's DOM offset to position the selection indicator
useLayoutEffect(() => {
const content = sidebarContentRef.current;
if (!content) {
diff --git a/apps/web/src/components/chat/OpenInPickerShortcut.ts b/apps/web/src/components/chat/OpenInPickerShortcut.ts
index 4def43be315..8c8249c67b1 100644
--- a/apps/web/src/components/chat/OpenInPickerShortcut.ts
+++ b/apps/web/src/components/chat/OpenInPickerShortcut.ts
@@ -52,6 +52,7 @@ export function useOpenFavoriteEditorShortcut({
const [preferredEditor] = usePreferredEditor(availableEditors);
const remote = useRemoteOpenState(environmentId);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes a window keydown listener for the open-in-editor shortcut while enabled locally
useEffect(() => {
if (!enabled || remote.mode !== "local-exec") return;
const handler = (event: globalThis.KeyboardEvent) => {
diff --git a/apps/web/src/components/chat/ThreadActivityAnnouncer.tsx b/apps/web/src/components/chat/ThreadActivityAnnouncer.tsx
index d82ec08f41c..998b9e1522a 100644
--- a/apps/web/src/components/chat/ThreadActivityAnnouncer.tsx
+++ b/apps/web/src/components/chat/ThreadActivityAnnouncer.tsx
@@ -25,6 +25,7 @@ export const ThreadActivityAnnouncer = memo(function ThreadActivityAnnouncer({
const { regionRef, announce, clear } = useLiveRegion();
const memoryRef = useRef<{ threadKey: string; memory: ThreadAnnouncementMemory } | null>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- writes thread status changes to the aria-live region after commit
useEffect(() => {
if (threadKey === null) {
memoryRef.current = null;
diff --git a/apps/web/src/components/chat/ThreadDetailsCard.tsx b/apps/web/src/components/chat/ThreadDetailsCard.tsx
index 42170a11476..bd4fde37a13 100644
--- a/apps/web/src/components/chat/ThreadDetailsCard.tsx
+++ b/apps/web/src/components/chat/ThreadDetailsCard.tsx
@@ -48,6 +48,7 @@ export function ThreadDetailsCard({
// inline flag, which live in three stores, so no single write site sees the
// card leave popover mode. A flag left set would reopen the popover unasked
// when the card returns to popover mode.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- closes the popover flag in the right panel store when the derived mode turns inline
useLayoutEffect(() => {
if (mode === "inline" && popoverOpen)
useRightPanelStore.getState().setThreadPanelOpen(threadRef, "popover", false);
@@ -56,6 +57,7 @@ export function ThreadDetailsCard({
const { environmentId, threadId } = threadRef;
// Re-measures when the density or measurement key changes, so each density's
// height is measured once it renders.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the card's DOM height via ResizeObserver and reports it to the canvas
useLayoutEffect(() => {
const element = contentElement;
if (!element || density === "essential") return;
diff --git a/apps/web/src/components/chat/ThreadFindBar.tsx b/apps/web/src/components/chat/ThreadFindBar.tsx
index aca1d6ca040..466cd929a75 100644
--- a/apps/web/src/components/chat/ThreadFindBar.tsx
+++ b/apps/web/src/components/chat/ThreadFindBar.tsx
@@ -26,6 +26,7 @@ export const THREAD_FIND_BAR_RESERVED_HEIGHT = 36 + THREAD_DETAILS_CARD_GAP;
export function ThreadFindBar(props: ThreadFindBarProps) {
const inputRef = useRef<HTMLInputElement | null>(null);
+ // 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
useEffect(() => {
if (!props.open) return;
inputRef.current?.focus();
diff --git a/apps/web/src/components/chat/ThreadTimeline.tsx b/apps/web/src/components/chat/ThreadTimeline.tsx
index 6a9d372e951..7d1db86178c 100644
--- a/apps/web/src/components/chat/ThreadTimeline.tsx
+++ b/apps/web/src/components/chat/ThreadTimeline.tsx
@@ -46,6 +46,7 @@ export function ThreadTimeline({
nextEntries: entries,
rememberedForActive: peekRememberedThreadTimeline<typeof entries>(activeThreadKey),
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- stores the committed ready timeline in the module-level cache used during thread switches
useLayoutEffect(() => {
if (detailLoading || entries.length === 0 || timelineHasEphemeralPreviewUrls(entries)) {
return;
diff --git a/apps/web/src/components/chat/TimelineWorkGroupRows.tsx b/apps/web/src/components/chat/TimelineWorkGroupRows.tsx
index c122caa96f3..27bdf77a871 100644
--- a/apps/web/src/components/chat/TimelineWorkGroupRows.tsx
+++ b/apps/web/src/components/chat/TimelineWorkGroupRows.tsx
@@ -200,6 +200,7 @@ function ExpandedWorkGroupEntries({
setRestoringPosition(false);
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes the list scroller and its content with ResizeObserver to update scroll fades
useLayoutEffect(() => {
const element = listRef.current?.getScrollableNode();
if (!element) return;
@@ -225,6 +226,7 @@ function ExpandedWorkGroupEntries({
setExpandedContentHeight(height);
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reads expanded row sizes from LegendList's measured state after layout
useLayoutEffect(updateExpandedContentHeight, [entries, updateExpandedContentHeight]);
return (
diff --git a/apps/web/src/components/chat/WorkLog.tsx b/apps/web/src/components/chat/WorkLog.tsx
index 90a42a68f0c..006e08f04f6 100644
--- a/apps/web/src/components/chat/WorkLog.tsx
+++ b/apps/web/src/components/chat/WorkLog.tsx
@@ -139,6 +139,7 @@ export function WorkLogDetails({
}) {
const scrollerRef = useRef<HTMLDivElement>(null);
const atLiveEdgeRef = useRef(true);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pins the scroller's scrollTop to the bottom after each commit while following live output
useLayoutEffect(() => {
const scroller = scrollerRef.current;
if (followLive && atLiveEdgeRef.current && scroller) {
diff --git a/apps/web/src/components/chat/composerContextUndo.ts b/apps/web/src/components/chat/composerContextUndo.ts
index dfceda613f0..fd2a0cde593 100644
--- a/apps/web/src/components/chat/composerContextUndo.ts
+++ b/apps/web/src/components/chat/composerContextUndo.ts
@@ -48,6 +48,7 @@ export function useRetainedContextPayloads(draftTargetKey: string): RetainedCont
setDraft({ targetKey: draftTargetKey, payloads: createRetainedContextPayloads() });
}
const retained = draft.payloads;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the retained payload maps when the draft target changes or the composer unmounts
useEffect(
() => () => {
for (const payloads of Object.values(retained)) payloads.clear();
diff --git a/apps/web/src/components/chat/threadContextDrag.ts b/apps/web/src/components/chat/threadContextDrag.ts
index 040e5a920e2..66e89060c23 100644
--- a/apps/web/src/components/chat/threadContextDrag.ts
+++ b/apps/web/src/components/chat/threadContextDrag.ts
@@ -10,6 +10,7 @@ export function useThreadContextDrop(
onDrop: (refs: ReadonlyArray<ScopedThreadRef>, isActive: () => boolean) => void,
) {
const handleDrop = useEffectEvent(onDrop);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes the target element to thread-context drop events and marks old drops inactive
useEffect(() => {
const target = targetRef.current;
if (!target) return;
diff --git a/apps/web/src/components/chat/threadFindHighlights.ts b/apps/web/src/components/chat/threadFindHighlights.ts
index 55d0647c9a8..65d3b0bb633 100644
--- a/apps/web/src/components/chat/threadFindHighlights.ts
+++ b/apps/web/src/components/chat/threadFindHighlights.ts
@@ -122,6 +122,7 @@ export function useThreadFindHighlights(input: {
// The observer repaints with whichever match is selected when text changes.
const readSelection = useEffectEvent(() => ({ activeRowId, activeOccurrence, onActiveRange }));
+ // 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
useEffect(() => {
if (typeof CSS === "undefined" || !CSS.highlights || typeof Highlight === "undefined") {
readSelection().onActiveRange(null);
@@ -208,6 +209,7 @@ export function useThreadFindHighlights(input: {
// onActiveRange is read at paint time: its identity follows the caller's
// layout inputs, and repainting the active highlight for those is wasted work.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- repaints the active CSS Highlight range when the selected match changes
useEffect(() => {
paintRef.current?.(rangesRef.current, {
activeRowId,
diff --git a/apps/web/src/components/chat/useAssistantCitationTarget.ts b/apps/web/src/components/chat/useAssistantCitationTarget.ts
index c59c68a303c..e8dd083e624 100644
--- a/apps/web/src/components/chat/useAssistantCitationTarget.ts
+++ b/apps/web/src/components/chat/useAssistantCitationTarget.ts
@@ -121,6 +121,7 @@ export function useAssistantCitationTarget({
// in a cleanup: StrictMode and <Activity> replay cleanups on a live activation.
// Unmounting needs no retire; the rows observing it unmount with the list.
const activatedRef = useRef<CitationNavigation | null>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- retires the replaced citation scroll and activates the new one, releasing the timeline follow
useEffect(() => {
if (activatedRef.current === current) return;
activatedRef.current?.retire();
@@ -129,6 +130,7 @@ export function useAssistantCitationTarget({
}, [current]);
// Escape and pointerdown dismiss before the viewport mounts; the viewport
// listeners join once it exists.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes document and viewport listeners that dismiss the pending citation scroll
useEffect(() => current?.attachDismissal(viewport), [current, viewport]);
const settled = current !== null && settlement?.target === current.target ? settlement : null;
diff --git a/apps/web/src/components/chat/useAttachmentPreviewHandoff.ts b/apps/web/src/components/chat/useAttachmentPreviewHandoff.ts
index c42047f2f48..7776151890e 100644
--- a/apps/web/src/components/chat/useAttachmentPreviewHandoff.ts
+++ b/apps/web/src/components/chat/useAttachmentPreviewHandoff.ts
@@ -37,6 +37,7 @@ export function useAttachmentPreviewHandoff(input: AttachmentPreviewHandoffInput
const handoffByMessageId = input.handoff;
// Blob URLs are a browser resource owned per thread; leaving the thread or the view ends them.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- revokes the thread's blob preview URLs when the thread changes or the view unmounts
useEffect(() => () => blobPreviews.revokeThread(threadId), [blobPreviews, threadId]);
const serverAttachmentResources = selectHandoffImageResources(
diff --git a/apps/web/src/components/chat/useChatShortcuts.ts b/apps/web/src/components/chat/useChatShortcuts.ts
index 6e4241ec6c4..c633bc91f9c 100644
--- a/apps/web/src/components/chat/useChatShortcuts.ts
+++ b/apps/web/src/components/chat/useChatShortcuts.ts
@@ -98,6 +98,7 @@ export function useChatShortcuts(input: ChatShortcutsInput) {
event.preventDefault();
input.closeThreadFind();
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- attaches window keydown listeners for chat shortcuts and find dismissal for the component's lifetime
useEffect(() => {
const onKeyDownCapture = (event: KeyboardEvent) => handleShortcut(event);
const onKeyDown = (event: KeyboardEvent) => dismissFind(event);
diff --git a/apps/web/src/components/chat/useComposerRestingTransition.ts b/apps/web/src/components/chat/useComposerRestingTransition.ts
index 64b18b67780..055fdfe263a 100644
--- a/apps/web/src/components/chat/useComposerRestingTransition.ts
+++ b/apps/web/src/components/chat/useComposerRestingTransition.ts
@@ -90,6 +90,7 @@ export function useComposerRestingTransition(
clearOverlayPin();
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- mirrors the collapsed flag into a ref read by ResizeObserver callbacks and running animations
useLayoutEffect(() => {
isCollapsedRef.current = isCollapsed;
});
@@ -434,6 +435,7 @@ export function useComposerRestingTransition(
};
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- runs the FLIP animation against committed DOM geometry before paint when the collapsed state changes
useLayoutEffect(() => {
const requestId = transitionLayoutRequestRef.current + 1;
transitionLayoutRequestRef.current = requestId;
@@ -452,6 +454,7 @@ export function useComposerRestingTransition(
};
}, [isCollapsed, transitionToCurrentGeometry]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the committed overlay element and reports its height when the resting state changes
useLayoutEffect(() => {
if (previousRestingRef.current === isResting) return;
previousRestingRef.current = isResting;
@@ -460,6 +463,7 @@ export function useComposerRestingTransition(
if (overlay) onOverlayHeightChange(overlay.getBoundingClientRect().height);
}, [isResting, onOverlayHeightChange]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes composer and body resize to record geometry and retarget a running animation
useLayoutEffect(() => {
const element = elementRef.current;
if (!element) return;
@@ -504,6 +508,7 @@ export function useComposerRestingTransition(
});
}, [restingControlsRef, transitionToCurrentGeometry]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the cleanup timer, cancels Web Animations and strips inline transition styles on unmount
useEffect(() => {
hasCompletedInitialLayoutRef.current = true;
return () => {
diff --git a/apps/web/src/components/chat/useComposerSend.ts b/apps/web/src/components/chat/useComposerSend.ts
index d932c4c0b4a..ba667c4857b 100644
--- a/apps/web/src/components/chat/useComposerSend.ts
+++ b/apps/web/src/components/chat/useComposerSend.ts
@@ -386,6 +386,7 @@ export function useComposerSend(input: ComposerSendInput) {
// A send awaits uploads before it declines, so it reads the approvals pending by then.
const pendingApprovalsRef = useRef(pendingApprovals);
const respondingRequestIdsRef = useRef(respondingRequestIds);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- mirrors approvals into refs that an async send reads after awaiting uploads
useLayoutEffect(() => {
pendingApprovalsRef.current = pendingApprovals;
respondingRequestIdsRef.current = respondingRequestIds;
diff --git a/apps/web/src/components/chat/useComposerStash.ts b/apps/web/src/components/chat/useComposerStash.ts
index ee7bacf4dbb..4bd42afd5b6 100644
--- a/apps/web/src/components/chat/useComposerStash.ts
+++ b/apps/web/src/components/chat/useComposerStash.ts
@@ -694,6 +694,7 @@ export function useComposerStash(input: {
).terminalOpen,
),
}));
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- registers the capture-phase stash shortcut with the command registry while the composer is mounted
useEffect(() => {
if (backgroundThread) return;
return registerCommands(
diff --git a/apps/web/src/components/chat/useComposerTypingGuard.ts b/apps/web/src/components/chat/useComposerTypingGuard.ts
index 22c517f4ed1..b1770ab3fdb 100644
--- a/apps/web/src/components/chat/useComposerTypingGuard.ts
+++ b/apps/web/src/components/chat/useComposerTypingGuard.ts
@@ -39,6 +39,7 @@ export function useComposerTypingGuard(scope: string, requestIds: readonly strin
const onFocus = () => dispatch({ type: "focus" });
const onBlur = () => dispatch({ type: "blur" });
const onSend = () => dispatch({ type: "send" });
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- schedules a timer that releases held requests once typing has been idle long enough
useEffect(() => {
if (state.held.size === 0) return;
const timeout = window.setTimeout(
diff --git a/apps/web/src/components/chat/useDraftEnvironmentRouting.ts b/apps/web/src/components/chat/useDraftEnvironmentRouting.ts
index 1ef648e48c9..790b9ce99a5 100644
--- a/apps/web/src/components/chat/useDraftEnvironmentRouting.ts
+++ b/apps/web/src/components/chat/useDraftEnvironmentRouting.ts
@@ -111,6 +111,7 @@ export function useDraftEnvironmentRouting(input: DraftEnvironmentRoutingInput)
loadBalancingCandidates,
loadBalancingSettings.loadBalancingWeights,
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- writes the resolved load-balanced environment into the draft store once the async pick settles
useEffect(() => {
if (!needsLoadBalancing || loadBalancing.pending || !draftId || sendInFlightRef.current) return;
const target = logicalProjectEnvironments.find(
@@ -171,10 +172,12 @@ export function useDraftEnvironmentRouting(input: DraftEnvironmentRoutingInput)
readonly scope: string;
} | null>(null);
const environmentChangeScopeRef = useRef("");
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- mirrors the current change scope into a ref that async environment switches compare against
useLayoutEffect(() => {
environmentChangeScopeRef.current = environmentChangeScope;
});
// Leaving the scope, or unmounting, abandons a change still in flight.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- abandons an in-flight environment change when the draft or project scope changes or unmounts
useLayoutEffect(
() => () => {
if (environmentChangeRef.current?.scope === environmentChangeScope) {
diff --git a/apps/web/src/components/chat/useDraftHeroLayoutTransition.ts b/apps/web/src/components/chat/useDraftHeroLayoutTransition.ts
index a156512a3d3..adecfc68a4b 100644
--- a/apps/web/src/components/chat/useDraftHeroLayoutTransition.ts
+++ b/apps/web/src/components/chat/useDraftHeroLayoutTransition.ts
@@ -19,6 +19,7 @@ export function useDraftHeroLayoutTransition(
previousComposerRectRef.current = composerAnchorRef.current?.getBoundingClientRect() ?? null;
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the committed composer rect and starts a FLIP Web Animation before paint
useLayoutEffect(() => {
const transitionGroup = transitionGroupRef.current;
const nextComposerRect = composerAnchorRef.current?.getBoundingClientRect() ?? null;
diff --git a/apps/web/src/components/chat/usePasteToFocusComposer.ts b/apps/web/src/components/chat/usePasteToFocusComposer.ts
index 7311b3f4c0e..7c16110c94d 100644
--- a/apps/web/src/components/chat/usePasteToFocusComposer.ts
+++ b/apps/web/src/components/chat/usePasteToFocusComposer.ts
@@ -16,6 +16,7 @@ export function usePasteToFocusComposer(
composerRef: ComposerHandleRef,
) {
const pasteAsTextShortcutUntilRef = useRef(0);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- attaches window keydown and paste capture listeners that route stray pastes into the composer
useEffect(() => {
const keyHandler = (event: KeyboardEvent) => {
if (
diff --git a/apps/web/src/components/chat/useRestingComposerControlsLayout.ts b/apps/web/src/components/chat/useRestingComposerControlsLayout.ts
index e75aab3a117..882aa14b369 100644
--- a/apps/web/src/components/chat/useRestingComposerControlsLayout.ts
+++ b/apps/web/src/components/chat/useRestingComposerControlsLayout.ts
@@ -45,6 +45,7 @@ export function useRestingComposerControlsLayout(
});
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- observes control resize, DOM mutations and font loading to measure which controls fit
useLayoutEffect(() => {
const currentHost = useControlsAsHost ? controls : host;
if (!currentHost || !controls) return;
diff --git a/apps/web/src/components/chat/useRightPanelActions.ts b/apps/web/src/components/chat/useRightPanelActions.ts
index be4c9dd9cbf..0e571b3c4a9 100644
--- a/apps/web/src/components/chat/useRightPanelActions.ts
+++ b/apps/web/src/components/chat/useRightPanelActions.ts
@@ -289,6 +289,7 @@ export function useRightPanelActions(input: RightPanelActionsInput) {
onDiffPanelOpen?.();
};
const onOpenTurnDiffStable = useStableCallback(onOpenTurnDiff);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to the preview action bus to toggle the preview panel
useEffect(
() =>
subscribePreviewAction((action) => {
diff --git a/apps/web/src/components/chat/useThreadFind.ts b/apps/web/src/components/chat/useThreadFind.ts
index bc66217cd4d..b88951e3b6a 100644
--- a/apps/web/src/components/chat/useThreadFind.ts
+++ b/apps/web/src/components/chat/useThreadFind.ts
@@ -180,11 +180,13 @@ export function useThreadFind({
}));
}
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reruns a live refresh that was coalesced behind a server search once that search settles
useEffect(() => {
if (!refreshAfterSearchRef.current || remote.isPending) return;
refreshAfterSearchRef.current = false;
if (!remote.error) refreshLiveResults();
}, [remote.isPending, remote.error]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- starts a debounce timer to refresh find results when streamed thread content changes
useEffect(() => {
if (lastContentRef.current === content) return;
lastContentRef.current = content;
@@ -194,6 +196,7 @@ export function useThreadFind({
refreshLiveResults();
}, 300);
}, [content, isOpen, state.query]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the pending refresh timer when the thread, open state or query changes
useEffect(() => {
if (!isOpen || threadKey === null || !state.query.trim()) return;
return () => {
diff --git a/apps/web/src/components/chat/useThreadFindNavigation.ts b/apps/web/src/components/chat/useThreadFindNavigation.ts
index 4bedf88b026..054faa23201 100644
--- a/apps/web/src/components/chat/useThreadFindNavigation.ts
+++ b/apps/web/src/components/chat/useThreadFindNavigation.ts
@@ -226,6 +226,7 @@ export function useThreadFindNavigation({
// scroll time; the viewport ref callback in MessagesTimeline cannot read
// them without a latest-ref mirror, and capturing them would re-attach the
// viewport (observers, citation dismissal) on every streamed entry.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- attaches a scroll listener to the timeline container to track the active match position
useEffect(() => {
if (!container) return;
const onScroll = () => {
@@ -250,6 +251,7 @@ export function useThreadFindNavigation({
key: null,
pages: new Set(),
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- requests earlier history pages until the active match's entry is loaded
useEffect(() => {
if (requestedPagesRef.current.key !== matchKey)
requestedPagesRef.current = { key: matchKey, pages: new Set() };
@@ -282,6 +284,7 @@ export function useThreadFindNavigation({
// Positioning also depends on the list: a loaded page or a shifted row must
// retry the jump for the same selection. Declared after the highlight
// effects so it reuses the range they just resolved.
+ // 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
useEffect(() => {
reveal(stateRef.current.activeRange, {
matchKey,
diff --git a/apps/web/src/components/chat/useThreadFindPositionReader.ts b/apps/web/src/components/chat/useThreadFindPositionReader.ts
index 6568db9d04d..79445a1afaf 100644
--- a/apps/web/src/components/chat/useThreadFindPositionReader.ts
+++ b/apps/web/src/components/chat/useThreadFindPositionReader.ts
@@ -37,6 +37,7 @@ export function useThreadFindPositionReader({
readonly contentInsetEndAdjustment: number;
}) {
// Layout effect so a find opened right after a thread switch reads this viewport.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- attaches the timeline viewport's position reader to the thread find registry
useLayoutEffect(() => {
if (!timelineViewportElement) return;
const read: ThreadFindPositionReader = (query) => {
diff --git a/apps/web/src/components/chat/useTimelineFollow.ts b/apps/web/src/components/chat/useTimelineFollow.ts
index c664f251abc..c8ebbbf06cf 100644
--- a/apps/web/src/components/chat/useTimelineFollow.ts
+++ b/apps/web/src/components/chat/useTimelineFollow.ts
@@ -358,7 +358,7 @@ export function useTimelineFollow(input: TimelineFollowInput) {
// The list does not follow footer layout, so the resting composer cannot scroll it. Growth
// above the composer (a new notice) would cover the last rows instead.
const followedInsetRef = useRef(composerTimelineInset);
- // oxlint-disable-next-line t3code/react-effect-budget -- scrolls the list after its bottom inset grows
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the list after its bottom inset grows
useLayoutEffect(() => {
const grew = composerTimelineInset > followedInsetRef.current;
followedInsetRef.current = composerTimelineInset;
@@ -552,6 +552,7 @@ export function useTimelineFollow(input: TimelineFollowInput) {
// the anchored end space; the trigger is streamed thread data. A
// totalSize listener cannot replace it: the anchored end space can already
// be 0, so dropping it changes no size and no list event fires.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the timeline to the end after the commit that drops anchored end space
useLayoutEffect(() => {
if (timelineAnchorMessageId === null || !timelineLiveFollowEnabled) return;
if (
diff --git a/apps/web/src/components/cloud/CloudEnvironmentConnectList.tsx b/apps/web/src/components/cloud/CloudEnvironmentConnectList.tsx
index ead9de10026..34dfbacc687 100644
--- a/apps/web/src/components/cloud/CloudEnvironmentConnectList.tsx
+++ b/apps/web/src/components/cloud/CloudEnvironmentConnectList.tsx
@@ -123,6 +123,7 @@ export function CloudEnvironmentConnectRows({
.map((environment) => environment.environmentId),
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- fetches relay discovery when its inputs change, unless hidden polling covers it, and reports readiness
useEffect(() => {
let active = true;
if (onDiscoveryReady || !refreshWhileEmpty || document.visibilityState === "visible") {
@@ -220,6 +221,7 @@ export function CloudEnvironmentConnectRows({
}
},
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- auto-selects newly discovered machines from the discovery store and starts their relay connections
useEffect(() => {
// 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.
selectNewComputers(environmentsState.environments);
@@ -229,6 +231,7 @@ export function CloudEnvironmentConnectRows({
const shouldRefreshWhileEmpty =
refreshWhileEmpty && visibleEnvironments.length === 0 && !environmentsState.offline;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- polls relay discovery on a timer, focus and visibility change while no machine is found
useEffect(() => {
if (!shouldRefreshWhileEmpty) return;
let timer: ReturnType<typeof setTimeout> | undefined;
diff --git a/apps/web/src/components/cloud/ConnectCliAuthSurface.tsx b/apps/web/src/components/cloud/ConnectCliAuthSurface.tsx
index 4eb372f3756..53085ecd50e 100644
--- a/apps/web/src/components/cloud/ConnectCliAuthSurface.tsx
+++ b/apps/web/src/components/cloud/ConnectCliAuthSurface.tsx
@@ -38,6 +38,7 @@ export function ConnectCliAuthorizeSurface() {
};
const openSignInOnLoad = useEffectEvent(openSignIn);
+ // 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
useEffect(() => {
if (!request || !isLoaded || redirecting.current) {
return;
diff --git a/apps/web/src/components/contextChipParts.tsx b/apps/web/src/components/contextChipParts.tsx
index 46476d0388e..b510c1275ee 100644
--- a/apps/web/src/components/contextChipParts.tsx
+++ b/apps/web/src/components/contextChipParts.tsx
@@ -252,6 +252,7 @@ function SvgFileChip(props: ComponentProps<typeof FileChip>) {
}
: null,
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- creates an object URL for the local SVG file and revokes it on cleanup
useEffect(() => {
const file = preview?.file;
if (!file) return;
diff --git a/apps/web/src/components/desktop/DesktopAppActivationCoordinator.tsx b/apps/web/src/components/desktop/DesktopAppActivationCoordinator.tsx
index 0b76660e7f3..96cb6c10fa4 100644
--- a/apps/web/src/components/desktop/DesktopAppActivationCoordinator.tsx
+++ b/apps/web/src/components/desktop/DesktopAppActivationCoordinator.tsx
@@ -71,6 +71,7 @@ export function DesktopAppActivationCoordinator() {
}),
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to desktop activation requests over the bridge and marks the renderer ready
useEffect(() => {
if (!ready || activation === undefined) return;
diff --git a/apps/web/src/components/desktop/DesktopWebLinkCoordinator.tsx b/apps/web/src/components/desktop/DesktopWebLinkCoordinator.tsx
index 8706f374522..768101cd5ad 100644
--- a/apps/web/src/components/desktop/DesktopWebLinkCoordinator.tsx
+++ b/apps/web/src/components/desktop/DesktopWebLinkCoordinator.tsx
@@ -163,6 +163,7 @@ export function DesktopWebLinkCoordinator() {
});
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to desktop web link opens over the bridge and marks the renderer ready
useEffect(() => {
if (!ready || webLinks === undefined) return;
let subscribed = true;
diff --git a/apps/web/src/components/desktop/SnapShotCoordinator.tsx b/apps/web/src/components/desktop/SnapShotCoordinator.tsx
index d1ff68f2aa2..43c515810e5 100644
--- a/apps/web/src/components/desktop/SnapShotCoordinator.tsx
+++ b/apps/web/src/components/desktop/SnapShotCoordinator.tsx
@@ -470,6 +470,7 @@ export function SnapShotCoordinator() {
}
},
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to SnapShot events from the desktop bridge and drains pending ones while enabled
useEffect(() => {
const bridge = getDesktopSnapShotBridge();
if (!bridge || !enabled) return;
@@ -477,6 +478,7 @@ export function SnapShotCoordinator() {
return bridge.onSnapShotEvent((event) => handleSnapShotEvent(bridge, event));
}, [enabled]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- attaches window blur, focus and visibilitychange listeners to dismiss or drain SnapShot animations
useEffect(() => {
const dismissOnBlur = () => {
pendingAnimationStartsRef.current.clear();
diff --git a/apps/web/src/components/device/DeviceDuoViewport.tsx b/apps/web/src/components/device/DeviceDuoViewport.tsx
index fe3726de5dd..8dbac16ee7b 100644
--- a/apps/web/src/components/device/DeviceDuoViewport.tsx
+++ b/apps/web/src/components/device/DeviceDuoViewport.tsx
@@ -39,6 +39,7 @@ export function DeviceDuoViewport(props: {
onFrameListener,
} = props;
+ // 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
useEffect(() => {
screenRef.current = props.screen;
modelRef.current = props.model;
@@ -46,6 +47,7 @@ export function DeviceDuoViewport(props: {
viewerRef.current?.setScreen(props.screen);
}, [props.screen, props.model]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes the hinge preview into the imperative 3D Duo viewer unless a pinch is active
useEffect(() => {
previewRef.current = props.hingePreview;
if (!pinchRef.current?.active) viewerRef.current?.setHingePreview(props.hingePreview);
diff --git a/apps/web/src/components/device/DevicePhoneViewport.tsx b/apps/web/src/components/device/DevicePhoneViewport.tsx
index d524e9d9ded..b3e03864664 100644
--- a/apps/web/src/components/device/DevicePhoneViewport.tsx
+++ b/apps/web/src/components/device/DevicePhoneViewport.tsx
@@ -33,11 +33,13 @@ export function DevicePhoneViewport(props: {
const accessoryRef = useRef(props.accessory);
const { source, onFrameListener, client, onInputCancel, onResetReady, onUnavailable } = props;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes the fold angle into the imperative 3D phone viewer
useEffect(() => {
foldAngleRef.current = props.foldAngle;
viewerRef.current?.setFoldAngle(props.foldAngle);
}, [props.foldAngle]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes screen, profile, model and accessory changes into the imperative 3D phone viewer
useEffect(() => {
screenRef.current = props.screen;
profileRef.current = props.profile;
diff --git a/apps/web/src/components/diffs/DiffCommentAnnotation.tsx b/apps/web/src/components/diffs/DiffCommentAnnotation.tsx
index 40214ec0bda..a2394854b5a 100644
--- a/apps/web/src/components/diffs/DiffCommentAnnotation.tsx
+++ b/apps/web/src/components/diffs/DiffCommentAnnotation.tsx
@@ -47,6 +47,7 @@ export function DiffCommentAnnotation({
const trimmedText = displayedText.trim();
const textareaRef = useRef<HTMLTextAreaElement | null>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- focuses the draft textarea on the next animation frame after mount
useLayoutEffect(() => {
if (kind !== "draft" || !focusOnMount) return;
const frame = window.requestAnimationFrame(() => {
diff --git a/apps/web/src/components/diffs/DiffFileLoadingBoundary.tsx b/apps/web/src/components/diffs/DiffFileLoadingBoundary.tsx
index 51716106c74..c1af18d7a69 100644
--- a/apps/web/src/components/diffs/DiffFileLoadingBoundary.tsx
+++ b/apps/web/src/components/diffs/DiffFileLoadingBoundary.tsx
@@ -17,6 +17,7 @@ export function DiffFileLoadingBoundary({ load, count }: { load: () => void; cou
};
// A settled batch shrinks `count` without moving the boundary out of range, and no new
// intersection entry arrives for that, so ask for the next batch whenever it changes.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- requests the next diff batch while the boundary is near the viewport and files remain
useEffect(() => {
if (isNear && count > 0) loadLatest();
}, [isNear, count, loadLatest]);
diff --git a/apps/web/src/components/diffs/DiffFileTree.tsx b/apps/web/src/components/diffs/DiffFileTree.tsx
index 9e2ecf11b6c..5a288c7ac08 100644
--- a/apps/web/src/components/diffs/DiffFileTree.tsx
+++ b/apps/web/src/components/diffs/DiffFileTree.tsx
@@ -95,10 +95,12 @@ export function DiffFileTree({
areAllDirectoriesExpanded(currentModel, directoryPaths),
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes the icon set into the imperative Pierre file tree model
useEffect(() => {
model.setIcons(icons);
}, [icons, model]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- applies path updates, ordering and git status to the imperative Pierre file tree model
useEffect(() => {
ordering.update(positions);
const mounted = mountedPresentationRef.current;
@@ -144,6 +146,7 @@ export function DiffFileTree({
model.setGitStatus(gitStatus);
}, [directoryPaths, gitStatus, model, modelPaths, ordering, positions, presented]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- expands ancestors, selects and scrolls to the requested file in the Pierre tree model
useEffect(() => {
if (selectedPath === null) {
handledRevealRef.current = null;
diff --git a/apps/web/src/components/files/AttachmentFilePreview.tsx b/apps/web/src/components/files/AttachmentFilePreview.tsx
index 5ab933a565c..e57289bd601 100644
--- a/apps/web/src/components/files/AttachmentFilePreview.tsx
+++ b/apps/web/src/components/files/AttachmentFilePreview.tsx
@@ -139,6 +139,7 @@ export function AttachmentFilePreview(props: {
const [contentError, setContentError] = useState<string | null>(null);
const copyContents = useRef<(() => Promise<string>) | null>(null);
const authorizedAt = useRef(0);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- creates an object URL for the local file and revokes it on cleanup
useEffect(() => {
if (!props.file) return;
const url = URL.createObjectURL(props.file);
@@ -146,6 +147,7 @@ export function AttachmentFilePreview(props: {
setLocalUrl(url);
return () => URL.revokeObjectURL(url);
}, [props.file]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- authorizes a remote attachment URL from the server and ignores the result after cleanup
useEffect(() => {
if (props.file) return;
let cancelled = false;
@@ -175,6 +177,7 @@ export function AttachmentFilePreview(props: {
(props.sizeBytes === 0 && (!resource || resource._tag === "attachment")));
const needsText =
kind === "text" || kind === "markdown" || kind === "mermaid" || (kind === "html" && !rendered);
+ // 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
useEffect(() => {
if (!needsText || streamsText || !url) return;
const controller = new AbortController();
diff --git a/apps/web/src/components/files/BinaryViewer.tsx b/apps/web/src/components/files/BinaryViewer.tsx
index 74a26455a3b..e87842efbed 100644
--- a/apps/web/src/components/files/BinaryViewer.tsx
+++ b/apps/web/src/components/files/BinaryViewer.tsx
@@ -46,7 +46,7 @@ function ArchiveFile(props: { readonly path: string; readonly bytes: Uint8Array<
return null;
}
})();
- // 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.
+ // 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.
useEffect(() => {
if (kind !== "image") return;
const extension = props.path.slice(props.path.lastIndexOf("."));
@@ -108,7 +108,7 @@ export default function BinaryViewer(props: {
}, 15_000);
workerRef.current?.postMessage(request);
};
- // oxlint-disable-next-line t3code/react-effect-budget -- Own the binary fetch, archive or database worker, message subscription, and request timeout for this file.
+ // 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.
useEffect(() => {
const controller = new AbortController();
const worker = new Worker(new URL("./binaryPreview.worker.ts", import.meta.url), {
diff --git a/apps/web/src/components/files/BrowserDocumentFrame.tsx b/apps/web/src/components/files/BrowserDocumentFrame.tsx
index 757d37a783f..e8d3139a8ae 100644
--- a/apps/web/src/components/files/BrowserDocumentFrame.tsx
+++ b/apps/web/src/components/files/BrowserDocumentFrame.tsx
@@ -156,6 +156,7 @@ export function HtmlRenderDocument(props: {
const postTheme = () => {
frameRef.current?.contentWindow?.postMessage(htmlRenderThemeMessage(theme), "*");
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- posts the current theme to the sandboxed iframe's window
useEffect(postTheme, [theme]);
const keybindings = useAtomValue(primaryServerKeybindingsAtom);
const environmentKeybindings = useAtomValue(
@@ -190,6 +191,7 @@ export function HtmlRenderDocument(props: {
"*",
);
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- posts allowed and blocked shortcuts to the sandboxed iframe's window
useEffect(postShortcuts, [blocked, shortcuts]);
// Pages can forge key/code pairs; reject pairs matching other bindings and require named keys to match the
// shortcut.
@@ -230,6 +232,7 @@ export function HtmlRenderDocument(props: {
void openLink(url, { event: modifiers }).catch((cause: unknown) => console.error(cause));
});
const { onFullscreenChange } = props;
+ // 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
useEffect(() => {
if (expandedImage === null) return;
onFullscreenChange?.(true);
@@ -266,6 +269,7 @@ export function HtmlRenderDocument(props: {
}
});
// Attach at commit because a fast page may post its initial height before passive effects run.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- attaches a window message listener for the iframe at commit, before its first height post
useLayoutEffect(() => {
const frame = frameRef.current;
if (frame === null) return;
diff --git a/apps/web/src/components/files/DocumentPages.tsx b/apps/web/src/components/files/DocumentPages.tsx
index 02715be64fb..b582ae67141 100644
--- a/apps/web/src/components/files/DocumentPages.tsx
+++ b/apps/web/src/components/files/DocumentPages.tsx
@@ -78,7 +78,7 @@ export default function DocumentPages(props: {
}) {
const { theme, resolvedTheme, themeHalves } = useTheme();
const [colors, setColors] = useState(documentColors);
- // oxlint-disable-next-line t3code/react-effect-budget -- Read the host DOM's applied theme tokens so the sandboxed document receives the current palette.
+ // 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.
useEffect(() => {
// The iframe cannot inherit the host palette across its sandbox boundary.
// 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: {
const [zoom, setZoom] = useState(1);
const [outputHeight, setOutputHeight] = useState(0);
const stopObserving = useRef<(() => void) | null>(null);
- // oxlint-disable-next-line t3code/react-effect-budget -- Disconnect the iframe body's resize observer when the document unmounts.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Disconnect the iframe body's resize observer when the document unmounts.
useEffect(() => () => stopObserving.current?.(), []);
const html = sanitizeDocumentHtml(props.html);
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>`;
diff --git a/apps/web/src/components/files/FileBrowserPanel.tsx b/apps/web/src/components/files/FileBrowserPanel.tsx
index faed4a113b8..7a6fa3a9405 100644
--- a/apps/web/src/components/files/FileBrowserPanel.tsx
+++ b/apps/web/src/components/files/FileBrowserPanel.tsx
@@ -294,6 +294,7 @@ export default function FileBrowserPanel({
onSearchChange: (value) => setQuery(value ?? ""),
unsafeCSS: PIERRE_TREE_UNSAFE_CSS,
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- makes the Pierre tree model re-render row decorations when loading directories change
useEffect(() => {
if (loadingDirectoriesRef.current === loadingDirectories) return;
loadingDirectoriesRef.current = loadingDirectories;
@@ -319,6 +320,7 @@ export default function FileBrowserPanel({
search.close();
};
const expandedPathsRef = useRef(new Set<string>());
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to the Pierre tree model to load directories as they are expanded
useEffect(() => {
const currentPaths = new Set(directoryPaths);
for (const path of expandedPathsRef.current) {
@@ -342,6 +344,7 @@ export default function FileBrowserPanel({
loadExpanded();
return model.subscribe(loadExpanded);
}, [directoryPaths, load, model]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes ignored-file status into the imperative Pierre tree model
useEffect(() => {
model.setGitStatus(
entries
@@ -352,6 +355,7 @@ export default function FileBrowserPanel({
})),
);
}, [entries, model]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- loads the selected file's ancestor directories and aborts on cleanup
useEffect(() => {
if (!selectedPath) return;
const controller = new AbortController();
@@ -382,6 +386,7 @@ export default function FileBrowserPanel({
resourceKey: `files:${environmentId}:${cwd}`,
});
+ // 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
useEffect(() => {
if (!ready) return;
if (previousTreePathsRef.current === treePaths) return;
@@ -396,11 +401,13 @@ export default function FileBrowserPanel({
if (updates.length > 0) model.batch(updates);
}, [ready, entryKinds, model, treePaths]);
+ // 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
useEffect(() => {
if (expandAll && !query.trim())
setAllDirectoriesExpanded(model, expandableDirectoryPaths, true);
}, [expandableDirectoryPaths, expandAll, model, query]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reveals an externally selected path in the Pierre tree model by expanding, selecting and scrolling
useEffect(() => {
if (!selectedPath) {
handledRevealRef.current = null;
diff --git a/apps/web/src/components/files/FilePreviewPanel.tsx b/apps/web/src/components/files/FilePreviewPanel.tsx
index b8b5376c017..56854b3ec6f 100644
--- a/apps/web/src/components/files/FilePreviewPanel.tsx
+++ b/apps/web/src/components/files/FilePreviewPanel.tsx
@@ -620,6 +620,7 @@ function useEditableAfterHighlight(file: FileContents) {
const needsHighlight = needsWorkerHighlight(workerPool, file);
const ready = !needsHighlight || highlightedFile === file;
+ // 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
useEffect(() => {
if (ready || workerPool === undefined) return;
workerPool.primeFileHighlightCache(file).catch(() => setHighlightedFile(file));
@@ -812,6 +813,7 @@ function EditableFileSurface({
const hasOpenCommentForm = lineAnnotations.some((annotation) =>
annotation.metadata.entries.some((entry) => entry.kind === "draft"),
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- installs selection dismissal listeners on the editor surface DOM node
useEffect(() => {
const root = surfaceRef.current;
if (!root) return;
@@ -1163,6 +1165,7 @@ export default function FilePreviewPanel({
: NO_FILE_REVISION_ATOM,
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the breadcrumb DOM so the deepest and current crumbs are in view after commit
useEffect(() => {
const crumbs = breadcrumbRef.current?.querySelectorAll<HTMLElement>("[data-file-crumb]");
// Show the deepest crumb when it fits, but never at the cost of the current one.
diff --git a/apps/web/src/components/files/FontViewer.tsx b/apps/web/src/components/files/FontViewer.tsx
index c88f5109244..fccb5a332ef 100644
--- a/apps/web/src/components/files/FontViewer.tsx
+++ b/apps/web/src/components/files/FontViewer.tsx
@@ -42,7 +42,7 @@ export default function FontViewer(props: { readonly src: string; readonly name:
const { resolvedTheme } = useTheme();
const [data, setData] = useState<string | null>(null);
const [error, setError] = useState<string | null>(null);
- // 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.
+ // 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.
useEffect(() => {
const controller = new AbortController();
const timeout = setTimeout(() => {
diff --git a/apps/web/src/components/files/InlineAudioPreview.tsx b/apps/web/src/components/files/InlineAudioPreview.tsx
index 0db2f835379..6cc0e18f047 100644
--- a/apps/web/src/components/files/InlineAudioPreview.tsx
+++ b/apps/web/src/components/files/InlineAudioPreview.tsx
@@ -23,6 +23,7 @@ export function InlineAudioPreview(props: {
const src = visible ? (asset._tag === "Success" ? asset.url : props.src) : undefined;
const failed = asset._tag === "Failure" || (src !== undefined && failedSrc === src);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- IntersectionObserver defers loading the audio until the element scrolls into view
useEffect(() => {
const element = container.current;
if (!element) return;
diff --git a/apps/web/src/components/files/LargeTextViewer.tsx b/apps/web/src/components/files/LargeTextViewer.tsx
index ae645f03417..a12842f7047 100644
--- a/apps/web/src/components/files/LargeTextViewer.tsx
+++ b/apps/web/src/components/files/LargeTextViewer.tsx
@@ -47,7 +47,7 @@ export default function LargeTextViewer(props: {
} | null>(null);
const pending = useRef(new Set<number>());
const wordWrap = useClientSettings((settings) => settings.wordWrap);
- // 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.
+ // 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.
useEffect(() => {
// oxlint-disable-next-line react/set-state-in-effect -- A replacement source must discard the previous worker's error and pages.
setError(null);
diff --git a/apps/web/src/components/files/NotebookPreview.tsx b/apps/web/src/components/files/NotebookPreview.tsx
index c32b9f84cd2..d5d56bb0d6d 100644
--- a/apps/web/src/components/files/NotebookPreview.tsx
+++ b/apps/web/src/components/files/NotebookPreview.tsx
@@ -57,7 +57,7 @@ export default function NotebookPreview(props: {
(count, cell) => count + cell.outputs.filter((output) => output.kind === "html").length,
0,
);
- // oxlint-disable-next-line t3code/react-effect-budget -- Observe output visibility and measure departing outputs to bound iframe lifetimes while preserving scroll height.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Observe output visibility and measure departing outputs to bound iframe lifetimes while preserving scroll height.
useEffect(() => {
const root = scroll.current;
if (!root || !outputCount) return;
diff --git a/apps/web/src/components/files/OfficeViewer.tsx b/apps/web/src/components/files/OfficeViewer.tsx
index dcec1626745..1af5f122a83 100644
--- a/apps/web/src/components/files/OfficeViewer.tsx
+++ b/apps/web/src/components/files/OfficeViewer.tsx
@@ -85,7 +85,7 @@ function ExtendedOfficeViewer(props: {
const [page, setPage] = useState(0);
const workerRef = useRef<Worker | null>(null);
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
- // oxlint-disable-next-line t3code/react-effect-budget -- Own the Office fetch, preparation worker, and timeout for this source and release them on cleanup.
+ // 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.
useEffect(() => {
const controller = new AbortController();
if ((props.sizeBytes ?? 0) > OFFICE_PREVIEW_MAX_BYTES) {
diff --git a/apps/web/src/components/files/OpenXmlOfficeViewer.tsx b/apps/web/src/components/files/OpenXmlOfficeViewer.tsx
index d17d1393807..8802e9fd291 100644
--- a/apps/web/src/components/files/OpenXmlOfficeViewer.tsx
+++ b/apps/web/src/components/files/OpenXmlOfficeViewer.tsx
@@ -45,7 +45,7 @@ export default function OfficeViewer(props: {
const fail = useStableCallback((cause: unknown) =>
setError(cause instanceof Error ? cause.message : "Could not render this Office document."),
);
- // 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.
+ // 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.
useEffect(() => {
if ((props.sizeBytes ?? 0) > OFFICE_PREVIEW_MAX_BYTES) {
// Metadata bounds are checked before fetching or starting an engine.
diff --git a/apps/web/src/components/files/PdfViewer.tsx b/apps/web/src/components/files/PdfViewer.tsx
index 4d86b66efb7..542f4031d48 100644
--- a/apps/web/src/components/files/PdfViewer.tsx
+++ b/apps/web/src/components/files/PdfViewer.tsx
@@ -42,7 +42,7 @@ function PdfPage(props: {
const canvas = useRef<HTMLCanvasElement>(null);
const text = useRef<HTMLDivElement>(null);
const { document: pdf, index, width, onSize, onError } = props;
- // 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.
+ // 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.
useEffect(() => {
let cancelled = false;
let paint: ReturnType<Awaited<ReturnType<PDFDocumentProxy["getPage"]>>["render"]> | undefined;
@@ -91,7 +91,7 @@ function PdfPage(props: {
void Promise.allSettled([paint?.promise]).then(() => loadedPage?.cleanup());
};
}, [pdf, index, width, onSize, onError]);
- // 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.
+ // 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.
useEffect(() => {
const node = text.current;
if (!node) return;
@@ -133,7 +133,7 @@ export default function PdfViewer(props: { src: string; title: string }) {
const scroll = useRef<HTMLDivElement>(null);
const find = useRef<HTMLInputElement>(null);
const zoomAnchor = useRef<{ page: number; offset: number; width: number } | null>(null);
- // 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.
+ // 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.
useEffect(() => {
const controller = new AbortController();
let disposed = false;
@@ -173,7 +173,7 @@ export default function PdfViewer(props: { src: string; title: string }) {
void task?.destroy();
};
}, [props.src, revision]);
- // 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.
+ // 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.
useLayoutEffect(() => {
const node = scroll.current;
if (!node) return;
@@ -206,7 +206,7 @@ export default function PdfViewer(props: { src: string; title: string }) {
};
setZoom(value);
};
- // oxlint-disable-next-line t3code/react-effect-budget -- Restore the DOM scroll anchor after the new zoom width has committed to page layout.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Restore the DOM scroll anchor after the new zoom width has committed to page layout.
useLayoutEffect(() => {
const anchor = zoomAnchor.current;
zoomAnchor.current = null;
@@ -215,11 +215,11 @@ export default function PdfViewer(props: { src: string; title: string }) {
top: offsets[anchor.page]! - 16 + (anchor.offset * width) / anchor.width,
});
});
- // oxlint-disable-next-line t3code/react-effect-budget -- Scroll to the first asynchronous search result after its measured page offsets have committed.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Scroll to the first asynchronous search result after its measured page offsets have committed.
useLayoutEffect(() => {
if (matches.length) jumpToPage(matches[0]!);
}, [matches]);
- // oxlint-disable-next-line t3code/react-effect-budget -- Debounce pdf.js text extraction and cancel obsolete searches when the query or document changes.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Debounce pdf.js text extraction and cancel obsolete searches when the query or document changes.
useEffect(() => {
if (!pdf || !query.trim()) {
// oxlint-disable-next-line react/set-state-in-effect -- A blank query cancels the previous search.
diff --git a/apps/web/src/components/files/PreviewImageContent.tsx b/apps/web/src/components/files/PreviewImageContent.tsx
index ab673d92cb8..9f57b464ccd 100644
--- a/apps/web/src/components/files/PreviewImageContent.tsx
+++ b/apps/web/src/components/files/PreviewImageContent.tsx
@@ -17,7 +17,7 @@ export default function PreviewImageContent(props: {
const [viewport, setViewport] = useState({ width: 0, height: 0 });
const [zoom, setZoom] = useState<number | null>(null);
const ref = useRef<HTMLDivElement>(null);
- // oxlint-disable-next-line t3code/react-effect-budget -- Measure the image viewport before paint and observe resizes to keep fit-to-view scaling accurate.
+ // 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.
useLayoutEffect(() => {
const node = ref.current;
if (!node) return;
diff --git a/apps/web/src/components/files/VirtualTablePreview.tsx b/apps/web/src/components/files/VirtualTablePreview.tsx
index f5ffd3793cf..5154153807d 100644
--- a/apps/web/src/components/files/VirtualTablePreview.tsx
+++ b/apps/web/src/components/files/VirtualTablePreview.tsx
@@ -23,7 +23,7 @@ export default function VirtualTablePreview(props: {
const widthRef = useRef(0);
const measureRef = useRef<HTMLTableElement>(null);
const [measured, setMeasured] = useState<number[] | null>(null);
- // oxlint-disable-next-line t3code/react-effect-budget -- Measure the viewport before paint and observe container resizes to invalidate column measurements.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Measure the viewport before paint and observe container resizes to invalidate column measurements.
useLayoutEffect(() => {
const node = ref.current;
if (!node) return;
@@ -39,7 +39,7 @@ export default function VirtualTablePreview(props: {
update();
return observeResize(node, update);
}, []);
- // oxlint-disable-next-line t3code/react-effect-budget -- Read the browser's laid-out table column widths before displaying the virtual table.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Read the browser's laid-out table column widths before displaying the virtual table.
useLayoutEffect(() => {
if (!width || !props.header || !measureRef.current || measured) return;
const widths = [...measureRef.current.querySelectorAll("thead th")].map(
@@ -184,7 +184,7 @@ function RowPage(
const rows = props.getRows(props.page);
// A page stays mounted while the worker fills it, preserving the scroll position.
const { loadPage, page } = props;
- // oxlint-disable-next-line t3code/react-effect-budget -- Request missing rows from the indexing worker while preserving the mounted page's scroll position.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Request this page's rows from the indexing worker when they are missing or incomplete.
useEffect(() => {
const expected = Math.min(PREVIEW_PAGE_ROWS, props.count - page * PREVIEW_PAGE_ROWS);
if (!rows || rows.length < expected) loadPage?.(page);
@@ -274,7 +274,7 @@ function ScaledRows(props: Omit<Parameters<typeof RowPage>[0], "page">) {
// The final mounted rows keep their measured height and scroll natively.
const nativeTail = first - headerRows === maxFirst;
const scrollModel = useRef({ scale, maxFirst, heights: [] as number[] });
- // oxlint-disable-next-line t3code/react-effect-budget -- Measure native tail rows and preserve the DOM scroll position when the virtual track scale changes.
+ // 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.
useLayoutEffect(() => {
const previous = scrollModel.current;
const heights = nativeTail
@@ -304,7 +304,7 @@ function ScaledRows(props: Omit<Parameters<typeof RowPage>[0], "page">) {
node.scrollTop = Math.min(maxFirst * 29, logicalTop) * scale + nativeOffset;
setTop(node.scrollTop);
});
- // oxlint-disable-next-line t3code/react-effect-budget -- Scroll the DOM viewport to a requested line after its virtual track has committed.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Scroll the DOM viewport to a requested line after its virtual track has committed.
useLayoutEffect(() => {
const node = ref.current;
if (props.revealLine == null) {
@@ -335,7 +335,7 @@ function ScaledRows(props: Omit<Parameters<typeof RowPage>[0], "page">) {
pendingEnd.current = false;
node.scrollTop += delta * (nativeTail ? 1 : (scale * 29) / rowHeight());
});
- // 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.
+ // 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.
useEffect(() => {
const node = ref.current;
if (!node) return;
@@ -347,7 +347,7 @@ function ScaledRows(props: Omit<Parameters<typeof RowPage>[0], "page">) {
}, []);
const page = Math.floor(first / PREVIEW_PAGE_ROWS);
const visibleEnd = (first % PREVIEW_PAGE_ROWS) + Math.ceil(position.height / 29) + 1;
- // 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.
+ // 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.
useLayoutEffect(() => {
if (atStart) return;
const node = contentRef.current;
@@ -366,7 +366,7 @@ function ScaledRows(props: Omit<Parameters<typeof RowPage>[0], "page">) {
update();
return observeResize(node, update);
}, [first, atStart]);
- // 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.
+ // 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.
useLayoutEffect(() => {
const pending = pendingReveal.current;
const node = ref.current;
@@ -406,7 +406,7 @@ function ScaledRows(props: Omit<Parameters<typeof RowPage>[0], "page">) {
node.scrollTop += delta * (nativeTail ? 1 : (scale * 29) / Math.max(29, bounds.height));
setTop(node.scrollTop);
});
- // 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.
+ // 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.
useLayoutEffect(() => {
const node = ref.current;
const content = contentRef.current;
diff --git a/apps/web/src/components/files/fileSaveSessions.ts b/apps/web/src/components/files/fileSaveSessions.ts
index 8c007347a73..69550e3ba78 100644
--- a/apps/web/src/components/files/fileSaveSessions.ts
+++ b/apps/web/src/components/files/fileSaveSessions.ts
@@ -166,7 +166,7 @@ export function useFileSaveSession(
{ environmentId, cwd, relativePath }: FileSaveTarget,
onPendingChange: FilePendingListener,
): void {
- // 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.
+ // 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.
useEffect(
() => fileSaveSessions.acquire({ environmentId, cwd, relativePath }, onPendingChange),
[environmentId, cwd, relativePath, onPendingChange],
diff --git a/apps/web/src/components/files/office/OfficePages.tsx b/apps/web/src/components/files/office/OfficePages.tsx
index d7b4b78c345..973b8a1feda 100644
--- a/apps/web/src/components/files/office/OfficePages.tsx
+++ b/apps/web/src/components/files/office/OfficePages.tsx
@@ -36,7 +36,7 @@ export function OfficePages(props: {
const [width, setWidth] = useState(0);
const [settledWidth, setSettledWidth] = useState(0);
const [mounted, setMounted] = useState(6);
- // oxlint-disable-next-line t3code/react-effect-budget -- Observe the scroll container width and debounce raster resizing, releasing the observer and timer on unmount.
+ // 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.
useEffect(() => {
const root = scroller.current;
if (!root) return;
@@ -53,7 +53,7 @@ export function OfficePages(props: {
unobserve();
};
}, []);
- // oxlint-disable-next-line t3code/react-effect-budget -- Yield between page mounting batches with a timer so large documents do not block the browser.
+ // 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.
useEffect(() => {
if (mounted >= props.pages.length) return;
const timer = setTimeout(() => setMounted((n) => Math.min(props.pages.length, n + 50)), 0);
@@ -146,7 +146,7 @@ function OfficePage(props: {
const canvas = useRef<HTMLCanvasElement>(null);
const [near, setNear] = useState(false);
const [ratio, setRatio] = useState(window.devicePixelRatio || 1);
- // oxlint-disable-next-line t3code/react-effect-budget -- Observe the page's viewport proximity to limit painting and text layers to nearby pages.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Observe the page's viewport proximity to limit painting and text layers to nearby pages.
useEffect(() => {
if (!row.current) return;
const observer = new IntersectionObserver(
@@ -156,14 +156,14 @@ function OfficePage(props: {
observer.observe(row.current);
return () => observer.disconnect();
}, [root]);
- // oxlint-disable-next-line t3code/react-effect-budget -- Subscribe to display density changes so canvas rasters match the current screen.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Subscribe to display density changes so canvas rasters match the current screen.
useEffect(() => {
const query = matchMedia(`(resolution: ${ratio}dppx)`);
const change = () => setRatio(window.devicePixelRatio || 1);
query.addEventListener("change", change);
return () => query.removeEventListener("change", change);
}, [ratio]);
- // oxlint-disable-next-line t3code/react-effect-budget -- Paint the visible page canvas at the current raster scale and cancel obsolete paint requests.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Paint the visible page canvas at the current raster scale and cancel obsolete paint requests.
useEffect(() => {
const target = canvas.current;
if (!target || !page || !near || ratio <= 0 || rasterScale <= 0) return;
@@ -173,7 +173,7 @@ function OfficePage(props: {
});
return () => controller.abort();
}, [near, index, page, paint, rasterScale, onError, ratio]);
- // oxlint-disable-next-line t3code/react-effect-budget -- Release the canvas backing store when its page moves away from the viewport.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Release the canvas backing store when its page moves away from the viewport.
useEffect(() => {
const target = canvas.current;
if (!near && target) {
diff --git a/apps/web/src/components/files/office/Presentation.tsx b/apps/web/src/components/files/office/Presentation.tsx
index b3a456c6464..891e40f91ad 100644
--- a/apps/web/src/components/files/office/Presentation.tsx
+++ b/apps/web/src/components/files/office/Presentation.tsx
@@ -26,7 +26,7 @@ export default function Presentation(props: {
const [page, setPage] = useState(0);
const [failed, setFailed] = useState<Record<number, boolean>>({});
const scroll = useRef<((index: number, y?: number) => void) | null>(null);
- // oxlint-disable-next-line t3code/react-effect-budget -- Open and paint slides through a worker whose requests and lifetime belong to this presentation.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Open and paint slides through a worker whose requests and lifetime belong to this presentation.
useEffect(() => {
const controller = new AbortController();
const worker = new Worker(new URL("./presentation.worker.ts", import.meta.url), {
diff --git a/apps/web/src/components/files/office/Spreadsheet.tsx b/apps/web/src/components/files/office/Spreadsheet.tsx
index e9789d415d4..6faa42d924c 100644
--- a/apps/web/src/components/files/office/Spreadsheet.tsx
+++ b/apps/web/src/components/files/office/Spreadsheet.tsx
@@ -49,7 +49,7 @@ export default function Spreadsheet(props: {
const [opened, setOpened] = useState<Opened>();
const [error, setError] = useState("");
const picking = useRef<AbortController | null>(null);
- // oxlint-disable-next-line t3code/react-effect-budget -- Open the workbook worker and cancel workbook and sheet requests when the source changes or unmounts.
+ // 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.
useEffect(() => {
const controller = new AbortController();
const worker = new Worker(new URL("./spreadsheet.worker.ts", import.meta.url), {
@@ -163,11 +163,11 @@ function SpreadsheetGrid(props: {
const [reader, setReader] = useState<{ row: number; col: number; text: string }[]>([]);
const [active, setActive] = useState({ row: 0, col: 0 });
const navigate = useRef(onNavigate);
- // oxlint-disable-next-line t3code/react-effect-budget -- Keep the installed native pointer listener calling the latest navigation handler without restarting the canvas engine.
+ // 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.
useEffect(() => {
navigate.current = onNavigate;
}, [onNavigate]);
- // 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.
+ // 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.
useEffect(() => {
const root = scroller.current;
const target = canvas.current;
diff --git a/apps/web/src/components/files/office/WordDocument.tsx b/apps/web/src/components/files/office/WordDocument.tsx
index 44d8b6f58c5..39ec9e982d2 100644
--- a/apps/web/src/components/files/office/WordDocument.tsx
+++ b/apps/web/src/components/files/office/WordDocument.tsx
@@ -28,7 +28,7 @@ export default function WordDocument(props: {
const { onError, bytes, onDetails } = props;
const [opened, setOpened] = useState<Opened>();
const scroll = useRef<((index: number, y?: number) => void) | null>(null);
- // 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.
+ // 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.
useEffect(() => {
const controller = new AbortController();
const worker = new Worker(new URL("./document.worker.ts", import.meta.url), { type: "module" });
@@ -121,7 +121,7 @@ function WordTextLayer(props: {
}) {
const { engine, index, page, follow } = props;
const [spans, setSpans] = useState<readonly WordSpan[]>([]);
- // 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.
+ // 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.
useEffect(() => {
if (!page) return;
const controller = new AbortController();
diff --git a/apps/web/src/components/files/useDirectoryEntries.ts b/apps/web/src/components/files/useDirectoryEntries.ts
index 30327e6f71f..d9517aad791 100644
--- a/apps/web/src/components/files/useDirectoryEntries.ts
+++ b/apps/web/src/components/files/useDirectoryEntries.ts
@@ -94,6 +94,7 @@ export function useDirectoryEntries(environmentId: EnvironmentId, cwd: string) {
return startRequest(directoryPath, refresh);
};
+ // 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
useEffect(() => {
active.current = true;
if (!requests.current.has("") && !loaded.current.has("")) void startRequest("", false);
diff --git a/apps/web/src/components/guest/GuestHtmlRender.tsx b/apps/web/src/components/guest/GuestHtmlRender.tsx
index 75b7445ac6e..4654d947b82 100644
--- a/apps/web/src/components/guest/GuestHtmlRender.tsx
+++ b/apps/web/src/components/guest/GuestHtmlRender.tsx
@@ -38,6 +38,7 @@ export function GuestHtmlRender({
() =>
`${GUEST_RENDER_ROUTE}?${GUEST_SHARE_PARAM}=${encodeURIComponent(shareId)}&item=${encodeURIComponent(itemId)}${htmlRenderThemeFragment(theme)}`,
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the frame box and follows its width with a ResizeObserver before paint
useLayoutEffect(() => {
const box = boxRef.current;
if (!box) return;
@@ -46,9 +47,11 @@ export function GuestHtmlRender({
if (entry) setWidth(entry.contentRect.width);
});
}, []);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- posts theme changes to the iframe's window
useEffect(() => {
frameRef.current?.contentWindow?.postMessage(htmlRenderThemeMessage(theme), "*");
}, [theme]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window message listener for the iframe's height reports and link requests
useEffect(() => {
const onMessage = (event: MessageEvent) => {
const frame = frameRef.current;
diff --git a/apps/web/src/components/guest/GuestPage.tsx b/apps/web/src/components/guest/GuestPage.tsx
index e860920692f..44820b0b1d2 100644
--- a/apps/web/src/components/guest/GuestPage.tsx
+++ b/apps/web/src/components/guest/GuestPage.tsx
@@ -175,6 +175,7 @@ export function GuestPage() {
// A browser that already joined this share goes straight back in, even from the spent link.
// Sessions are per share, so one for another link never stands in for this one.
const [access, setAccess] = useState<GuestAccess>(shareId === null ? "none" : "checking");
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- fetches whether this browser already has a guest session and ignores the answer after cleanup
useEffect(() => {
if (shareId === null) return;
let live = true;
@@ -195,6 +196,7 @@ export function GuestPage() {
}, [credential, shareId]);
// Pasting another guest link into this tab changes only the hash, which does not reload the
// page; reload so the new invite is read instead of the one already captured.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- hashchange listener reloads the page when another guest link is pasted into this tab
useEffect(() => {
const onHashChange = () => {
if (window.location.hash !== "") window.location.reload();
@@ -233,15 +235,18 @@ function GuestSession({ shareId }: { readonly shareId: string }) {
...initialGuestStreamState,
awaitingRowIds: readAwaitingRowIds(),
}));
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- persists the awaiting row ids to sessionStorage so a reload keeps them
useEffect(() => writeAwaitingRowIds(stream.awaitingRowIds), [stream.awaitingRowIds]);
// EventSource closes for good only on a non-200 response, which the guest routes send for a
// missing, invalid, or ended session. Network drops reconnect on their own.
const [rejected, setRejected] = useState(false);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- sets document.title to the shared thread's title
useEffect(() => {
if (stream.view) document.title = stream.view.title;
}, [stream.view]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens the guest EventSource stream and closes it on cleanup
useEffect(() => {
const source = new EventSource(
`${GUEST_ROUTE_PREFIX}/stream?${GUEST_SHARE_PARAM}=${encodeURIComponent(shareId)}`,
@@ -419,6 +424,7 @@ function GuestThread({
const previousUnplacedKey = useRef(unplacedKey);
const following = useRef(follow.timelineLiveFollowEnabled);
const scrollToEnd = useStableCallback(follow.scrollToEnd);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the timeline to the end after commit when new unplaced messages appear
useEffect(() => {
following.current = follow.timelineLiveFollowEnabled;
const previous = new Set(previousUnplacedKey.current.split(","));
@@ -427,6 +433,7 @@ function GuestThread({
}, [follow.timelineLiveFollowEnabled, unplacedKey, scrollToEnd, following, previousUnplacedKey]);
const footerRef = useRef<HTMLOListElement>(null);
const hasFooter = unplaced.length > 0;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- ResizeObserver on the footer keeps it scrolled into view while following
useEffect(() => {
const footer = footerRef.current;
if (!hasFooter || footer === null) return;
diff --git a/apps/web/src/components/media/AttachmentImage.tsx b/apps/web/src/components/media/AttachmentImage.tsx
index ea1a7c19057..ce39f5d7ac5 100644
--- a/apps/web/src/components/media/AttachmentImage.tsx
+++ b/apps/web/src/components/media/AttachmentImage.tsx
@@ -48,7 +48,7 @@ function DecodedImage({ name, mimeType, src, onError, ...props }: AttachmentImag
});
};
- // oxlint-disable-next-line t3code/react-effect-budget -- the async decode and its blob URL live as long as this component
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- the async decode and its blob URL live as long as this component
useEffect(
() => () => {
const attempt = decodeRef.current;
diff --git a/apps/web/src/components/onboarding/FirstRunGate.tsx b/apps/web/src/components/onboarding/FirstRunGate.tsx
index da707b549ac..8aa16fe030c 100644
--- a/apps/web/src/components/onboarding/FirstRunGate.tsx
+++ b/apps/web/src/components/onboarding/FirstRunGate.tsx
@@ -140,6 +140,7 @@ export function FirstRunGate({
if (transitioned !== gateState) setGateState(transitioned);
}
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- persists onboarding completion to settings once the gate settles on skipping the wizard
useEffect(() => {
if (decision === "wizard" || !hydrated) return;
if (persistCompletion && onboardingCompletedAt === null) {
@@ -147,6 +148,7 @@ export function FirstRunGate({
}
}, [decision, hydrated, onboardingCompletedAt, persistCompletion]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- timer gives up on a pending first-run decision after the timeout
useEffect(() => {
if (!enabled || decision !== "pending" || !hydrated) return;
const timer = window.setTimeout(
@@ -159,6 +161,7 @@ export function FirstRunGate({
// Setup opens by itself only from the home route. A direct link, such as
// Settings, opens as asked so setup can never lock a user out of the app.
const wizardOwnsRoute = pathname === "/";
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- navigates from the home route to /welcome when the gate decides on the wizard
useEffect(() => {
if (decision === "wizard" && wizardOwnsRoute) {
void navigate({ to: "/welcome", replace: true });
diff --git a/apps/web/src/components/onboarding/WelcomeWizard.tsx b/apps/web/src/components/onboarding/WelcomeWizard.tsx
index 6dd38d13127..50d65192c02 100644
--- a/apps/web/src/components/onboarding/WelcomeWizard.tsx
+++ b/apps/web/src/components/onboarding/WelcomeWizard.tsx
@@ -128,6 +128,7 @@ export function WelcomeWizard({
const finishingPromiseRef = useRef<Promise<boolean> | null>(null);
const completionErrorToastIdRef = useRef<ReturnType<typeof toastManager.add> | null>(null);
const primaryEnvironment = usePrimaryEnvironment();
+ // 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
useEffect(() => {
const newComputers = environments.filter(
(environment) => !autoSelectedComputers.has(environment.environmentId),
@@ -319,6 +320,7 @@ function ConnectionStep({
.filter((environment) => skippedIds.includes(environment.environmentId))
.map((environment) => environment.label);
const continueRef = useRef<HTMLButtonElement>(null);
+ // 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
useEffect(() => {
if (
ready &&
@@ -552,6 +554,7 @@ function PairingForm({
const [errorMessage, setErrorMessage] = useState("");
const mountedRef = useRef(true);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- tracks mount so a pairing request that settles after unmount does not set state
useEffect(() => {
mountedRef.current = true;
return () => {
@@ -718,6 +721,7 @@ function ConnectedAgentsStep({
} | null>(null);
const canOperateTerminal = useEnvironmentScope(environmentId, AuthTerminalOperateScope);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- asks the environment to refresh its provider list when the environment changes
useEffect(() => {
void refreshProviders({ environmentId, input: {} });
}, [environmentId, refreshProviders]);
@@ -1035,6 +1039,7 @@ function AgentInstallTerminal({
// StrictMode can finish a cancelled open after replacement setup; it must not close or pre-type into that
// session.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens the setup PTY, types the command into it, and closes it on cleanup
useEffect(() => {
const generation = setupGenerationRef.current + 1;
setupGenerationRef.current = generation;
@@ -1197,6 +1202,7 @@ function ImportStep({
);
const importGenerationRef = useRef(0);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- bumps the import generation on mount and unmount so in-flight imports drop stale results
useEffect(() => {
importGenerationRef.current += 1;
return () => {
diff --git a/apps/web/src/components/preview/AgentBrowserCursor.tsx b/apps/web/src/components/preview/AgentBrowserCursor.tsx
index bbe890d4d5d..341ea891b18 100644
--- a/apps/web/src/components/preview/AgentBrowserCursor.tsx
+++ b/apps/web/src/components/preview/AgentBrowserCursor.tsx
@@ -66,6 +66,7 @@ export function AgentCursorMark(props: {
const [inactiveSequence, setInactiveSequence] = useState<number | null>(null);
const active = inactiveSequence !== sequence;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- timer fades the agent cursor after each move or click
useEffect(() => {
const timeout = window.setTimeout(() => setInactiveSequence(sequence), CURSOR_ACTIVE_MS);
return () => window.clearTimeout(timeout);
diff --git a/apps/web/src/components/preview/PreviewPanelShell.tsx b/apps/web/src/components/preview/PreviewPanelShell.tsx
index 7624c3df222..51e74bd605a 100644
--- a/apps/web/src/components/preview/PreviewPanelShell.tsx
+++ b/apps/web/src/components/preview/PreviewPanelShell.tsx
@@ -79,6 +79,7 @@ function PreviewPanelShellFrame(
stopObservingRow();
};
};
+ // 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
useLayoutEffect(() => {
const host = hostRef.current;
if (!host || !collapsible) return;
@@ -92,6 +93,7 @@ function PreviewPanelShellFrame(
});
};
}, [collapsible, hostRef]);
+ // 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
useLayoutEffect(() => {
const host = hostRef.current;
if (!host) return;
diff --git a/apps/web/src/components/preview/PreviewView.tsx b/apps/web/src/components/preview/PreviewView.tsx
index ce09ed3a043..8bc3f8f77a6 100644
--- a/apps/web/src/components/preview/PreviewView.tsx
+++ b/apps/web/src/components/preview/PreviewView.tsx
@@ -192,6 +192,7 @@ export function PreviewView({
const serverToolbarShown =
snapshot?.runtime === "server" && (snapshot.viewport ?? FILL_PREVIEW_VIEWPORT)._tag !== "fill";
const serverBodyRef = useRef<HTMLDivElement | null>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- ResizeObserver on the server preview body sizes the viewport toolbar
useEffect(() => {
const element = serverBodyRef.current;
if (!element || !serverToolbarShown) return;
@@ -790,6 +791,7 @@ export function PreviewView({
}).then(finishPick);
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- tells the preview bridge whether an element pick may send annotations
useEffect(() => {
if (!pickActive || !previewBridge || !runtimeTabId) return;
void previewBridge
@@ -797,6 +799,7 @@ export function PreviewView({
.catch(() => undefined);
}, [canSendAnnotation, pickActive, runtimeTabId]);
+ // 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
useEffect(() => {
return () => {
if (!pickActiveRef.current) return;
@@ -833,6 +836,7 @@ export function PreviewView({
}
},
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to preview actions while the view is visible
useEffect(() => {
if (!visible) return;
return subscribePreviewAction((action) => onPreviewAction(action));
diff --git a/apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx b/apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx
index a5c3525c3c9..edfdc2bccbc 100644
--- a/apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx
+++ b/apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx
@@ -440,6 +440,7 @@ function MiniPlayerShell({
const [pillOpen, setPillOpen] = useState(false);
const handleTappedRef = useRef(false);
const handleRef = useRef<HTMLDivElement | null>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- document pointerdown listener closes the open pill on an outside press
useEffect(() => {
if (!pillOpen) return;
const dismiss = (event: PointerEvent) => {
diff --git a/apps/web/src/components/preview/ZoomIndicator.tsx b/apps/web/src/components/preview/ZoomIndicator.tsx
index 7988bf44c55..2ee75430443 100644
--- a/apps/web/src/components/preview/ZoomIndicator.tsx
+++ b/apps/web/src/components/preview/ZoomIndicator.tsx
@@ -14,6 +14,7 @@ export function ZoomIndicator({ zoomFactor }: Props) {
const lastFactorRef = useRef(zoomFactor);
const timerRef = useRef<number | null>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- shows the indicator on a zoom change and hides it with a timer
useEffect(() => {
if (Math.abs(lastFactorRef.current - zoomFactor) < ZOOM_EPSILON) return;
lastFactorRef.current = zoomFactor;
diff --git a/apps/web/src/components/preview/usePreviewBridge.ts b/apps/web/src/components/preview/usePreviewBridge.ts
index 69c6be2046f..92bc9b29b35 100644
--- a/apps/web/src/components/preview/usePreviewBridge.ts
+++ b/apps/web/src/components/preview/usePreviewBridge.ts
@@ -84,6 +84,7 @@ export function usePreviewBridge(input: {
});
},
);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to preview bridge state changes and capture activity for the current tab
useEffect(() => {
if (!previewBridge || typeof window === "undefined") return;
lastReportedUrl.current = null;
diff --git a/apps/web/src/components/projectScriptEditor.tsx b/apps/web/src/components/projectScriptEditor.tsx
index 7f44194f983..8bb765ff5f7 100644
--- a/apps/web/src/components/projectScriptEditor.tsx
+++ b/apps/web/src/components/projectScriptEditor.tsx
@@ -282,6 +282,7 @@ function ProjectScriptEditorForm({
const pendingSubmissionRef = useRef<object | null>(null);
// A save that settles after this form is replaced must not close or error
// the request that replaced it.
+ // 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
useEffect(
() => () => {
pendingSubmissionRef.current = null;
diff --git a/apps/web/src/components/promptLinks/HostedPromptLinkLanding.tsx b/apps/web/src/components/promptLinks/HostedPromptLinkLanding.tsx
index 69233976f16..24facbea191 100644
--- a/apps/web/src/components/promptLinks/HostedPromptLinkLanding.tsx
+++ b/apps/web/src/components/promptLinks/HostedPromptLinkLanding.tsx
@@ -104,6 +104,7 @@ function HostedPromptLinkLanding({
const onPhone = /android|iphone|ipad/i.test(navigator.userAgent);
const autoOpenedRef = useRef(false);
+ // 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
useEffect(() => {
if (!openInAppRemembered || !summary.ok || autoOpenedRef.current) return;
autoOpenedRef.current = true;
diff --git a/apps/web/src/components/promptLinks/NewThreadLinkView.tsx b/apps/web/src/components/promptLinks/NewThreadLinkView.tsx
index 16f1932dd15..12abbeabd13 100644
--- a/apps/web/src/components/promptLinks/NewThreadLinkView.tsx
+++ b/apps/web/src/components/promptLinks/NewThreadLinkView.tsx
@@ -325,6 +325,7 @@ export function NewThreadLinkView({ link }: { readonly link: NewThreadLink }) {
}
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- runs each launch decision once: navigates to the thread or opens a draft
useEffect(() => {
if (launch === null || launchedRef.current === launch) return;
launchedRef.current = launch;
@@ -394,6 +395,7 @@ function PullRequestLinkCheckout({
},
});
const warnedRef = useRef(false);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- shows the hidden-characters warning toast once per linked prompt
useEffect(() => {
if (warnedRef.current || link.prompt === null) return;
warnedRef.current = true;
diff --git a/apps/web/src/components/promptLinks/ThreadLinkPrompt.tsx b/apps/web/src/components/promptLinks/ThreadLinkPrompt.tsx
index 956df9eed73..847ad68a71e 100644
--- a/apps/web/src/components/promptLinks/ThreadLinkPrompt.tsx
+++ b/apps/web/src/components/promptLinks/ThreadLinkPrompt.tsx
@@ -20,6 +20,7 @@ export function ThreadLinkPrompt({ threadRef }: { readonly threadRef: ScopedThre
structuralSharing: true,
});
+ // 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
useEffect(() => {
// A pending navigation shows the next location while the params still name this thread.
if (!isThreadRoutePathname(location.pathname, threadRef)) return;
diff --git a/apps/web/src/components/pullRequest/PullRequestCodeTab.tsx b/apps/web/src/components/pullRequest/PullRequestCodeTab.tsx
index 22a244e809c..f8d58cfaa02 100644
--- a/apps/web/src/components/pullRequest/PullRequestCodeTab.tsx
+++ b/apps/web/src/components/pullRequest/PullRequestCodeTab.tsx
@@ -435,6 +435,7 @@ function PullRequestCodeTab({
isStale: isFileViewedStale,
} = filesViewed;
const appliedRefreshToken = useRef(refreshToken);
+ // 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
useEffect(() => {
if (appliedRefreshToken.current === refreshToken) return;
appliedRefreshToken.current = refreshToken;
@@ -446,6 +447,7 @@ function PullRequestCodeTab({
refreshFilesViewed();
}, [refreshToken, scopeKey, refreshFirstDiffPage, refreshFilesViewed]);
const appliedBackgroundRefreshToken = useRef(backgroundRefreshToken);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- a background refresh token refetches the first diff page and viewed files while keeping slices
useEffect(() => {
if (appliedBackgroundRefreshToken.current === backgroundRefreshToken) return;
appliedBackgroundRefreshToken.current = backgroundRefreshToken;
@@ -1296,6 +1298,7 @@ function PullRequestCodeTab({
answeredRevealNonce.current = revealRequest.nonce;
revealFile(revealRequest.path);
});
+ // 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
useEffect(() => {
// oxlint-disable-next-line react/set-state-in-effect -- A reveal for a file not loaded yet pages forward, which sets the slice cursor.
answerReveal();
diff --git a/apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx b/apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
index 2fd7bacb66d..b9e1633efce 100644
--- a/apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
+++ b/apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
@@ -433,6 +433,7 @@ export function PullRequestDetailPanel({
scroller: HTMLDivElement;
target: number;
} | null>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- restores the scroller's scrollTop before paint after the header condenses
useLayoutEffect(() => {
const compensation = compensationRef.current;
if (compensation === null) return;
@@ -486,6 +487,7 @@ export function PullRequestDetailPanel({
event.stopPropagation();
if (!event.repeat) copyReference(`#${reference.number}`, `${terminology.shortLabel} number`);
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window keydown capture listener for the copy-number shortcut
useEffect(() => {
const onKeyDown = (event: KeyboardEvent) => copyFromShortcut(event);
window.addEventListener("keydown", onKeyDown, true);
@@ -576,6 +578,7 @@ export function PullRequestDetailPanel({
}
}
const revalidateActivity = useEffectEvent(() => activityQuery.refresh());
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- refreshes the activity query after commit when render counts a new detail revision
useEffect(() => {
if (activityRevalidations > 0) revalidateActivity();
}, [activityRevalidations]);
@@ -598,6 +601,7 @@ export function PullRequestDetailPanel({
};
const refreshFromHostOnRequest = useEffectEvent(() => void refreshFromHost());
const appliedForcedToken = useRef(forcedRefreshToken);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- a new forced refresh token invalidates the host cache and refetches
useEffect(() => {
if (appliedForcedToken.current === forcedRefreshToken) return;
appliedForcedToken.current = forcedRefreshToken;
diff --git a/apps/web/src/components/pullRequest/PullRequestGuideTab.tsx b/apps/web/src/components/pullRequest/PullRequestGuideTab.tsx
index 8046653f110..fef668b3f34 100644
--- a/apps/web/src/components/pullRequest/PullRequestGuideTab.tsx
+++ b/apps/web/src/components/pullRequest/PullRequestGuideTab.tsx
@@ -78,6 +78,7 @@ export function PullRequestGuideTab({
const guide = data?.guide ?? null;
const tourShown = active && guide !== null;
const reportTourShown = useEffectEvent(() => onTourShown?.());
+ // 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
useEffect(() => {
if (tourShown) reportTourShown();
}, [tourShown]);
diff --git a/apps/web/src/components/pullRequest/PullRequestsColumn.tsx b/apps/web/src/components/pullRequest/PullRequestsColumn.tsx
index 324bb88d37b..93562d834d2 100644
--- a/apps/web/src/components/pullRequest/PullRequestsColumn.tsx
+++ b/apps/web/src/components/pullRequest/PullRequestsColumn.tsx
@@ -35,6 +35,7 @@ function ExpandableSearch({
onFocusWithin?: (focused: boolean) => void;
}) {
const containerRef = useRef<HTMLDivElement | null>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- focuses the search input DOM node when the topbar search opens
useEffect(() => {
if (!open) return;
containerRef.current?.querySelector("input")?.focus();
@@ -109,6 +110,7 @@ export function PullRequestsColumn({
}) {
const markerRef = useRef<HTMLDivElement | null>(null);
const [condensed, setCondensed] = useState(false);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- IntersectionObserver on the scroll marker condenses the topbar
useEffect(() => {
const marker = markerRef.current;
if (!marker) return;
@@ -126,6 +128,7 @@ export function PullRequestsColumn({
const [searchOpen, setSearchOpen] = useState(false);
const topbarSearchRef = useRef<HTMLDivElement | null>(null);
const searchExpanded = searchOpen || searchValue.length > 0;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window keydown listener focuses the visible search input on Cmd/Ctrl+F
useEffect(() => {
const onKeyDown = (event: KeyboardEvent) => {
if (event.defaultPrevented) return;
@@ -142,6 +145,7 @@ export function PullRequestsColumn({
return () => window.removeEventListener("keydown", onKeyDown);
}, [condensed]);
if (!condensed && searchOpen) setSearchOpen(false);
+ // 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
useEffect(() => {
if (condensed) return;
if (!topbarSearchFocusedRef.current) return;
diff --git a/apps/web/src/components/pullRequest/PullRequestsPage.tsx b/apps/web/src/components/pullRequest/PullRequestsPage.tsx
index 9e4de110fac..359d86b4fc7 100644
--- a/apps/web/src/components/pullRequest/PullRequestsPage.tsx
+++ b/apps/web/src/components/pullRequest/PullRequestsPage.tsx
@@ -765,6 +765,7 @@ export function PullRequestsPage() {
statsByRow,
pending: statsQuery.isPending,
}));
+ // 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
useEffect(() => {
if (statsPolicy !== "eager") return;
const { statsByRow: known } = readStatsProgress();
@@ -784,6 +785,7 @@ export function PullRequestsPage() {
}, [filterKey, entriesByStatsKey, statsPolicy]);
// The observer outlives the rows it watches, so it reads the rows held at the time it fires.
const readStatsRows = useEffectEvent(() => entriesByStatsKey);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- IntersectionObserver on rows requests stats for rows that scroll into view
useEffect(() => {
if (statsPolicy !== "visible" || typeof IntersectionObserver === "undefined") return;
visibleStatsKeys.current = { key: filterKey, values: new Set() };
@@ -833,6 +835,7 @@ export function PullRequestsPage() {
if (statsObserver.current === observer) statsObserver.current = null;
};
}, [filterKey, statsPolicy]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- prunes stats batches to the observer's visible rows once a stats request settles
useEffect(() => {
if (statsPolicy !== "visible" || statsQuery.isPending) return;
const visible = visibleStatsKeys.current;
@@ -919,6 +922,7 @@ export function PullRequestsPage() {
closeBatch,
hostActionsOf,
}));
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the pointer close-sweep sensor when the list changes or on unmount
useEffect(
() => () => closeSensorRef.current?.cancel(),
// 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() {
if (rightPanelState.isOpen) setMaximized((value) => !value);
};
const onGuideShown = () => setMaximized(true);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens the URL-linked pull request in the right panel store
useEffect(() => {
if (!pullRequestsSupported || rightPanelRef === null || linkedSelection === null) return;
useRightPanelStore.getState().openPullRequest(rightPanelRef, linkedSelection);
@@ -1426,6 +1431,7 @@ export function PullRequestsPage() {
event.stopPropagation();
if (!event.repeat) toggleRightPanelMaximized();
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- document keydown listener for the right panel and copy-reference shortcuts
useEffect(() => {
const onKeyDown = (event: KeyboardEvent) => {
if (event.defaultPrevented || isCommandPaletteOpen()) return;
diff --git a/apps/web/src/components/pullRequest/guide/GuideTour.tsx b/apps/web/src/components/pullRequest/guide/GuideTour.tsx
index e374bc59b5e..81074bef9ce 100644
--- a/apps/web/src/components/pullRequest/guide/GuideTour.tsx
+++ b/apps/web/src/components/pullRequest/guide/GuideTour.tsx
@@ -86,6 +86,7 @@ export function GuideTour({
event.preventDefault();
step(event.key === "j" ? 1 : -1);
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- document keydown listener for j/k tour stepping while the guide is active
useEffect(() => {
if (!active) return;
const onKeyDown = (event: KeyboardEvent) => stepFromKey(event);
diff --git a/apps/web/src/components/pullRequest/usePullRequestListView.ts b/apps/web/src/components/pullRequest/usePullRequestListView.ts
index 36451f6eab9..de3d7a1dc52 100644
--- a/apps/web/src/components/pullRequest/usePullRequestListView.ts
+++ b/apps/web/src/components/pullRequest/usePullRequestListView.ts
@@ -185,6 +185,7 @@ export function usePullRequestScope(search: PullRequestsSearch) {
export function usePullRequestQueryFilters(search: PullRequestsSearch, typedQuery: string) {
const [sentQuery, setSentQuery] = useState(typedQuery);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- debounce timer that sends the typed query after SEARCH_DEBOUNCE_MS
useEffect(() => {
const timer = window.setTimeout(() => setSentQuery(typedQuery), SEARCH_DEBOUNCE_MS);
return () => window.clearTimeout(timer);
diff --git a/apps/web/src/components/pullRequest/useThreadLinkedPullRequest.ts b/apps/web/src/components/pullRequest/useThreadLinkedPullRequest.ts
index 18b8c0a9c10..acecaaf6e14 100644
--- a/apps/web/src/components/pullRequest/useThreadLinkedPullRequest.ts
+++ b/apps/web/src/components/pullRequest/useThreadLinkedPullRequest.ts
@@ -50,6 +50,7 @@ export function useThreadLinkedPullRequest(input: {
const relinkKeysRef = useRef(new Map<string, string>());
const relinkWriteRef = useRef(Promise.resolve());
+ // 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
useEffect(() => {
if (serverThreadRef === null) return;
const threadKey = scopedThreadKey(serverThreadRef);
diff --git a/apps/web/src/components/settings/AddEnvironmentDialog.tsx b/apps/web/src/components/settings/AddEnvironmentDialog.tsx
index b14a6edebec..22bb624c275 100644
--- a/apps/web/src/components/settings/AddEnvironmentDialog.tsx
+++ b/apps/web/src/components/settings/AddEnvironmentDialog.tsx
@@ -124,6 +124,7 @@ export function AddEnvironmentDialog({
// The discovery atom is kept alive across dialog opens, so re-read SSH config
// each time the SSH tab is shown; stale hosts stay visible while it refreshes.
const refreshDesktopSshHosts = desktopSshHosts.refresh;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- rereads desktop SSH config through the bridge each time the SSH tab is shown
useEffect(() => {
if (isSshDiscoveryActive) refreshDesktopSshHosts();
}, [isSshDiscoveryActive, refreshDesktopSshHosts]);
diff --git a/apps/web/src/components/settings/CodexSetupSection.tsx b/apps/web/src/components/settings/CodexSetupSection.tsx
index afdde3f13a6..adbe87bc579 100644
--- a/apps/web/src/components/settings/CodexSetupSection.tsx
+++ b/apps/web/src/components/settings/CodexSetupSection.tsx
@@ -315,6 +315,7 @@ function ManagedCodexSetup({
};
const abortOperation = () => operation.current?.abort();
// Once the card unmounts, nothing may start a sign-in or open a page on its behalf.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- aborts the in-flight setup or sign-in AbortController on unmount
useEffect(() => () => operation.current?.abort(), []);
const [autoStartHandled, setAutoStartHandled] = useState(false);
const installed = installation?.installedVersion != null;
@@ -336,6 +337,7 @@ function ManagedCodexSetup({
}
// The server does not refresh the provider snapshot when a sign-in flow
// succeeds, and the flow can finish elsewhere (callback, pasted redirect URL).
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- asks the server to refresh the provider snapshot once the sign-in flow succeeds
useEffect(() => {
if (awaitingProvider && auth?.phase === "succeeded") {
void refreshProviders({ environmentId, input: { instanceId } });
@@ -405,6 +407,7 @@ function ManagedCodexSetup({
const transferFinishedProfile = useEffectEvent((profile: ChatGptTransferredProfile) =>
transferProfile(profile),
);
+ // 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
useEffect(() => {
if (!handoff || handoffQuery.data?.phase !== "finished") return;
const attemptId = handoff.input.attemptId;
@@ -571,11 +574,13 @@ function ManagedCodexSetup({
onAutoStartConsumed();
void setup();
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- dispatches the automatic setup server command after the auto-start flag commits
useEffect(() => {
// oxlint-disable-next-line react/set-state-in-effect -- Starting setup dispatches a server command, which marks itself pending before it awaits.
if (autoStartHandled) startAutomatically();
}, [autoStartHandled]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- cancels the desktop bridge provider auth callback when the URL changes or the card unmounts
useEffect(() => {
if (!clientCallback || !url || !window.desktopBridge?.cancelProviderAuthCallback) return;
return () => {
diff --git a/apps/web/src/components/settings/FontFamilyPicker.tsx b/apps/web/src/components/settings/FontFamilyPicker.tsx
index 93edc8d327c..3f6d5d6f59b 100644
--- a/apps/web/src/components/settings/FontFamilyPicker.tsx
+++ b/apps/web/src/components/settings/FontFamilyPicker.tsx
@@ -98,6 +98,7 @@ export function FontFamilyPicker({
// Base UI needs an initial closed commit; mounting open loses exit transitionend and leaves the popup
// stuck.
const [openAfterMount] = useState(initialOpen);
+ // 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
useEffect(() => {
// oxlint-disable-next-line react/set-state-in-effect -- Base UI needs one closed commit first to record the popup's entrance style.
if (openAfterMount) setOpen(true);
diff --git a/apps/web/src/components/settings/ProviderAuthTerminal.tsx b/apps/web/src/components/settings/ProviderAuthTerminal.tsx
index b21a3642902..47cace9e673 100644
--- a/apps/web/src/components/settings/ProviderAuthTerminal.tsx
+++ b/apps/web/src/components/settings/ProviderAuthTerminal.tsx
@@ -20,6 +20,7 @@ export default function ProviderAuthTerminal({
// The surface captures its callbacks once at creation.
const respond = useStableCallback(onResponse);
const offset = outputOffset ?? output.length;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- writes new auth output into the imperative Ghostty terminal surface
useEffect(() => {
if (!surface) return;
const delta = offset - written.current;
diff --git a/apps/web/src/components/settings/ProviderModelsSection.tsx b/apps/web/src/components/settings/ProviderModelsSection.tsx
index 51d388913ef..4b044b5d70e 100644
--- a/apps/web/src/components/settings/ProviderModelsSection.tsx
+++ b/apps/web/src/components/settings/ProviderModelsSection.tsx
@@ -156,6 +156,7 @@ export function ProviderModelsSection({
: displayModels;
// A model added or moved lands in a later commit, so each commit looks for the pending row.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the pending model's DOM row into view once a later commit renders it
useEffect(() => {
const slug = scrollToSlugRef.current;
if (slug === null) return;
diff --git a/apps/web/src/components/settings/SavedEnvironmentRows.tsx b/apps/web/src/components/settings/SavedEnvironmentRows.tsx
index 5a331193bca..a0c07c78454 100644
--- a/apps/web/src/components/settings/SavedEnvironmentRows.tsx
+++ b/apps/web/src/components/settings/SavedEnvironmentRows.tsx
@@ -504,6 +504,7 @@ function ConfiguredCloudLinkRow({ canManageRelay }: { readonly canManageRelay: b
const refreshLinkState = useEffectEvent(primaryCloudLinkState.refresh);
// The server rechecks reachability when the tunnel's 30 s readiness poll changes.
// Poll while mounted, so a failed read does not stop later ones.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- 30 s interval that refreshes the cloud link reachability while mounted
useEffect(() => {
const interval = window.setInterval(() => refreshLinkState(), 30_000);
return () => window.clearInterval(interval);
diff --git a/apps/web/src/components/settings/SettingsFontPreviews.tsx b/apps/web/src/components/settings/SettingsFontPreviews.tsx
index 17efc7f1d77..4b43f8ecc6e 100644
--- a/apps/web/src/components/settings/SettingsFontPreviews.tsx
+++ b/apps/web/src/components/settings/SettingsFontPreviews.tsx
@@ -156,6 +156,7 @@ export function TerminalFontPreview({ family, size }: { family: string; size: nu
const { theme, resolvedTheme } = useTheme();
// The box grows with the font so the whole transcript shows without scrolling.
+ // 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
useEffect(() => {
if (!surface) return;
void surface.setFont(previewTerminalFont(family, size)).then(() => {
@@ -169,6 +170,7 @@ export function TerminalFontPreview({ family, size }: { family: string; size: nu
}, [surface, family, size]);
// Palette changes may preserve light/dark mode; re-read terminal tokens for every theme change.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes theme tokens read from the DOM's computed styles into the Ghostty preview surface
useEffect(() => {
const mount = mountRef.current;
if (!mount || !surface) return;
diff --git a/apps/web/src/components/settings/SettingsSidebarNav.tsx b/apps/web/src/components/settings/SettingsSidebarNav.tsx
index 1d2bdc46708..5ece7c51cea 100644
--- a/apps/web/src/components/settings/SettingsSidebarNav.tsx
+++ b/apps/web/src/components/settings/SettingsSidebarNav.tsx
@@ -143,6 +143,7 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
setActiveResultIndex(maxResultIndex);
}
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window keydown listener for the find and slash search shortcuts
useEffect(() => {
const handleKeyDown = (event: globalThis.KeyboardEvent) => {
if (event.defaultPrevented || event.isComposing) return;
@@ -178,6 +179,7 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
return () => window.removeEventListener("keydown", handleKeyDown);
}, []);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- focuses the search input DOM node after the compact search opens
useEffect(() => {
if (compactSearchOpen) searchInputRef.current?.focus();
}, [compactSearchOpen]);
diff --git a/apps/web/src/components/settings/TelemetryExportSettings.tsx b/apps/web/src/components/settings/TelemetryExportSettings.tsx
index d4aabc92bd4..54856b81dac 100644
--- a/apps/web/src/components/settings/TelemetryExportSettings.tsx
+++ b/apps/web/src/components/settings/TelemetryExportSettings.tsx
@@ -136,6 +136,7 @@ function TelemetryExportForm() {
if (check?.result === null) void sendCheck(key, signal, check.url);
}
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- sends pending endpoint check requests once the environment can run them
useEffect(() => {
// oxlint-disable-next-line react/set-state-in-effect -- State changes only after the response arrives.
if (canCheck) sendPendingChecks();
diff --git a/apps/web/src/components/settings/ThemeColorPicker.tsx b/apps/web/src/components/settings/ThemeColorPicker.tsx
index 1bf7c23cf7e..ef2c81511b6 100644
--- a/apps/web/src/components/settings/ThemeColorPicker.tsx
+++ b/apps/web/src/components/settings/ThemeColorPicker.tsx
@@ -249,6 +249,7 @@ function ThemeColorPicker({
}) {
const [committer] = useState(createFrameCommitter);
// Unmounting with the popover open (the editor closes mid-drag) never fires onOpenChange.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- flushes the frame committer on unmount, since an open popover never fires onOpenChange
useEffect(() => committer.flush, [committer]);
return (
<Popover
diff --git a/apps/web/src/components/settings/ThemeEditorPanel.tsx b/apps/web/src/components/settings/ThemeEditorPanel.tsx
index 9b71401c79b..f6992e1f7ec 100644
--- a/apps/web/src/components/settings/ThemeEditorPanel.tsx
+++ b/apps/web/src/components/settings/ThemeEditorPanel.tsx
@@ -434,11 +434,13 @@ export function ThemeEditorPanel({
}
}
+ // 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
useEffect(() => {
if (!open) return;
applyThemeColorPreview(colorsByAppearance[activeAppearance], activeAppearance);
}, [activeAppearance, colorsByAppearance, open]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- restores the document theme when the editor closes or unmounts
useEffect(() => {
if (!open) return;
return () => {
@@ -510,6 +512,7 @@ export function ThemeEditorPanel({
: [];
const selectedHighlightRolesKey = selectedHighlightRoles.join(",");
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- highlights role usage in the DOM, refreshed by a MutationObserver and resize and scroll listeners
useEffect(() => {
clearThemeInspectorHighlights();
if (!open || selectedRole === null || isInspecting) return;
@@ -570,6 +573,7 @@ export function ThemeEditorPanel({
};
}, [isInspecting, open, selectedHighlightRolesKey, selectedRole]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- document pointer, click and key listeners that drive the inspect-mode hover overlay
useEffect(() => {
if (!open || !isInspecting) {
clearThemeInspectorHover();
diff --git a/apps/web/src/components/settings/TypographySettings.tsx b/apps/web/src/components/settings/TypographySettings.tsx
index 1f813beedea..a4380a3e0bd 100644
--- a/apps/web/src/components/settings/TypographySettings.tsx
+++ b/apps/web/src/components/settings/TypographySettings.tsx
@@ -328,6 +328,7 @@ export function TypographySection() {
// rows without it would make terminal font edits do nothing. The rows follow the target
// directly so its row mounts in the first commit; the target clears once handled.
const searchTargetId = useSettingsSearchTargetId();
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- writes the advanced typography flag to localStorage when a search target needs it
useEffect(() => {
if (searchTargetId !== null) revealSettingsSearchTarget(searchTargetId);
}, [searchTargetId]);
@@ -398,6 +399,7 @@ function FontFamilySettingsRow({
setDraftSettled(true);
}
const readAdoptedGeneration = useEffectEvent(() => adopted.generation);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the pending commit timer on unmount
useEffect(
() => () => {
if (commitTimerRef.current !== null) window.clearTimeout(commitTimerRef.current.id);
diff --git a/apps/web/src/components/settings/useSnapShotShortcutRecorder.tsx b/apps/web/src/components/settings/useSnapShotShortcutRecorder.tsx
index b59789274b9..787d1843cac 100644
--- a/apps/web/src/components/settings/useSnapShotShortcutRecorder.tsx
+++ b/apps/web/src/components/settings/useSnapShotShortcutRecorder.tsx
@@ -73,6 +73,7 @@ export function useSnapShotShortcutRecorder({
onError(error instanceof Error ? error.message : "Could not start shortcut recording.");
}
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- releases the desktop bridge's SnapShot shortcut suppression on unmount
useEffect(
() => () => {
requests.clear();
diff --git a/apps/web/src/components/sidebar/SidebarProviderUpdatePill.tsx b/apps/web/src/components/sidebar/SidebarProviderUpdatePill.tsx
index 5a5e7e4f25d..69de2e934c8 100644
--- a/apps/web/src/components/sidebar/SidebarProviderUpdatePill.tsx
+++ b/apps/web/src/components/sidebar/SidebarProviderUpdatePill.tsx
@@ -111,6 +111,7 @@ export function SidebarProviderUpdatePill() {
setDismissAfterExitKey(null);
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- fallback timer that finishes the exit if the CSS transition never ends
useEffect(() => {
if (exitingKey === null) return;
// A cancelled or skipped CSS transition must not keep a hidden spinner mounted.
@@ -118,6 +119,7 @@ export function SidebarProviderUpdatePill() {
return () => window.clearTimeout(timeoutId);
}, [exitingKey]);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- timer that dismisses the pill after it has been visible for dismissAfterVisibleMs
useEffect(() => {
if (!dismissAfterVisibleMs || !viewKey) {
return;
diff --git a/apps/web/src/components/ui/middle-truncate.tsx b/apps/web/src/components/ui/middle-truncate.tsx
index e4b74ec9ced..62dd3c58ecc 100644
--- a/apps/web/src/components/ui/middle-truncate.tsx
+++ b/apps/web/src/components/ui/middle-truncate.tsx
@@ -19,6 +19,7 @@ export function MiddleTruncate({
const split = splitForMiddleTruncate(value, tail);
const headRef = useRef<HTMLSpanElement>(null);
const head = split?.head;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- fits the head span's DOM text and refits it through a ResizeObserver
useLayoutEffect(() => {
const element = headRef.current;
// A new head can keep the same box size, so refit here, not only on resize.
diff --git a/apps/web/src/components/ui/toast.tsx b/apps/web/src/components/ui/toast.tsx
index e476b308fc4..acf7cf11934 100644
--- a/apps/web/src/components/ui/toast.tsx
+++ b/apps/web/src/components/ui/toast.tsx
@@ -469,6 +469,7 @@ function ThreadToastVisibleAutoDismiss({
toastId: ToastId;
dismissAfterVisibleMs: number | undefined;
}) {
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- dismiss timer that pauses on visibilitychange, focus and blur so it only counts visible time
useEffect(() => {
if (!dismissAfterVisibleMs || dismissAfterVisibleMs <= 0) return;
if (typeof window === "undefined" || typeof document === "undefined") return;
@@ -558,6 +559,7 @@ function Toasts({ position }: { position: ToastPosition }) {
);
const visibleToastLayout = buildVisibleToastLayout(visibleToasts);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- prunes the module-level remaining-time map of toasts the manager has dropped
useEffect(() => {
const activeToastIds = new Set(toasts.map((toast) => toast.id));
for (const toastId of threadToastVisibleTimeoutRemainingMs.keys()) {
diff --git a/apps/web/src/components/ui/tooltip.tsx b/apps/web/src/components/ui/tooltip.tsx
index 98044ed02f4..1e6fd85f680 100644
--- a/apps/web/src/components/ui/tooltip.tsx
+++ b/apps/web/src/components/ui/tooltip.tsx
@@ -64,6 +64,7 @@ function Tooltip<Payload>(props: TooltipPrimitive.Root.Props<Payload>) {
const tracker = use(TooltipScrollContext);
const localActionsRef = useRef<TooltipPrimitive.Root.Actions | null>(null);
const actionsRef = props.actionsRef ?? localActionsRef;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- releases this tooltip from the scroll tracker on unmount
useEffect(() => () => tracker?.release(actionsRef), [actionsRef, tracker]);
if (!tracker) return <TooltipPrimitive.Root {...props} />;
diff --git a/apps/web/src/components/usage/UsageLimits.tsx b/apps/web/src/components/usage/UsageLimits.tsx
index 504009d769a..e34965632b0 100644
--- a/apps/web/src/components/usage/UsageLimits.tsx
+++ b/apps/web/src/components/usage/UsageLimits.tsx
@@ -102,6 +102,7 @@ function paceMarkStyles(timeLeft: number | null) {
export function usePaceMark(timeLeft: number | null) {
const [bar, setBar] = useState<HTMLElement | null>(null);
const [roomy, setRoomy] = useState(false);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- measures the bar DOM width before paint and remeasures through a ResizeObserver
useLayoutEffect(() => {
if (!bar) return;
const measure = () => setRoomy(bar.getBoundingClientRect().width >= 6);
diff --git a/apps/web/src/components/usage/UsageLimitsPooled.tsx b/apps/web/src/components/usage/UsageLimitsPooled.tsx
index f195a4290ee..7157607daba 100644
--- a/apps/web/src/components/usage/UsageLimitsPooled.tsx
+++ b/apps/web/src/components/usage/UsageLimitsPooled.tsx
@@ -252,6 +252,7 @@ function ActiveSegmentPopover({
// The trigger is gone, so the popup has nothing to anchor to: an exit transition would
// slide it to the viewport origin. Unmount it outright, which also clears Base UI's
// active-trigger bookkeeping so the segment can open again when it comes back.
+ // 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
useLayoutEffect(() => {
if (available) return;
handle.close();
diff --git a/apps/web/src/components/usage/UsagePage.tsx b/apps/web/src/components/usage/UsagePage.tsx
index a26daff1894..8373d3439eb 100644
--- a/apps/web/src/components/usage/UsagePage.tsx
+++ b/apps/web/src/components/usage/UsagePage.tsx
@@ -153,6 +153,7 @@ function UsageModelDialogHost({
readonly onSetPrice: (model: string) => void;
}) {
const selectedKey = useAtomValue(selectedUsageModelKeyAtom);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the shared selected-model atom on unmount
useEffect(() => () => selectUsageModel(null), []);
const model =
selectedKey === null
@@ -289,6 +290,7 @@ export function UsagePage() {
if (periodOption && !showingLimits) selectWindow(periodOption.days);
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window capture keydown listener for usage metric and period shortcuts
useEffect(() => {
globalThis.window.addEventListener("keydown", onUsageKeyDown, true);
return () => globalThis.window.removeEventListener("keydown", onUsageKeyDown, true);
@@ -335,6 +337,7 @@ export function UsagePage() {
const autoRefreshLimits = useEffectEvent(() => {
void refreshLimits(true);
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- refreshes provider limits from the server when the connected environment set changes
useEffect(() => {
if (showingLimits && connectedLimitsEnvironments) autoRefreshLimits();
}, [showingLimits, connectedLimitsEnvironments]);
diff --git a/apps/web/src/components/usage/UsageProviderChart.tsx b/apps/web/src/components/usage/UsageProviderChart.tsx
index c4f958ae772..1745be4df89 100644
--- a/apps/web/src/components/usage/UsageProviderChart.tsx
+++ b/apps/web/src/components/usage/UsageProviderChart.tsx
@@ -331,6 +331,7 @@ function UsageChartPlot({
plot.style.setProperty("--usage-tooltip-top", `${top}px`);
};
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- positions the hover tooltip through plot CSS variables before paint and on ResizeObserver
useLayoutEffect(() => {
if (hoverIndex === null) return;
positionTooltip();
diff --git a/apps/web/src/hooks/FileMetadataThreadProvider.tsx b/apps/web/src/hooks/FileMetadataThreadProvider.tsx
index 77b082d1f54..c85f8e693ee 100644
--- a/apps/web/src/hooks/FileMetadataThreadProvider.tsx
+++ b/apps/web/src/hooks/FileMetadataThreadProvider.tsx
@@ -29,6 +29,7 @@ export function FileMetadataThreadProvider(props: {
checkpoints: OrchestrationV2ThreadProjection["checkpoints"];
} | null>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- invalidates the server file metadata cache for files whose checkpoints changed
useEffect(() => {
if (!threadRef || !cwd || !checkpoints) {
previous.current = null;
diff --git a/apps/web/src/hooks/useCopyToClipboard.ts b/apps/web/src/hooks/useCopyToClipboard.ts
index 2ca31031efc..c61fbe13de3 100644
--- a/apps/web/src/hooks/useCopyToClipboard.ts
+++ b/apps/web/src/hooks/useCopyToClipboard.ts
@@ -232,6 +232,7 @@ export function useCopyToClipboard<TContext = void>({
);
});
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- clears the copied-state reset timer on unmount
React.useEffect(() => {
return (): void => {
if (timeoutIdRef.current) {
diff --git a/apps/web/src/hooks/useLiveRefresh.ts b/apps/web/src/hooks/useLiveRefresh.ts
index b355b0a91ba..d261a13ad65 100644
--- a/apps/web/src/hooks/useLiveRefresh.ts
+++ b/apps/web/src/hooks/useLiveRefresh.ts
@@ -99,6 +99,7 @@ export function useLiveRefresh(
const fallbackViewId = useId();
const viewId = key ?? fallbackViewId;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- refresh interval tied to page visibility and user interaction listeners
useEffect(() => {
if (!enabled) return;
const read = (now: number) => runRefresh(viewId, now);
diff --git a/apps/web/src/hooks/useProactivePanels.ts b/apps/web/src/hooks/useProactivePanels.ts
index 488fcf04e33..60c78a850c2 100644
--- a/apps/web/src/hooks/useProactivePanels.ts
+++ b/apps/web/src/hooks/useProactivePanels.ts
@@ -69,6 +69,7 @@ export function useProactivePanels(input: {
> | null>(null);
const threadKey = threadRef ? scopedThreadKey(threadRef) : null;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- opens proactive surfaces in the right panel store as runs and linked PRs change
useEffect(() => {
if (threadKey === null || threadRef === null) {
proactivePanelObservationRef.current = null;
diff --git a/apps/web/src/hooks/useResizableWidth.ts b/apps/web/src/hooks/useResizableWidth.ts
index 39585837dfb..16bb1982913 100644
--- a/apps/web/src/hooks/useResizableWidth.ts
+++ b/apps/web/src/hooks/useResizableWidth.ts
@@ -89,6 +89,7 @@ export function useResizableWidth(options: UseResizableWidthOptions): {
// Bounds can change mid-drag (sidebar opens, window narrows), and the render
// that carries them rewrites the committed width, so re-apply the live pointer position.
const { refresh } = drag;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- reapplies the live drag pointer position to the DOM before paint when the bounds change
useLayoutEffect(() => refresh({ min: minWidth, max: maxWidth }), [refresh, minWidth, maxWidth]);
return {
diff --git a/apps/web/src/hooks/useStableCallback.ts b/apps/web/src/hooks/useStableCallback.ts
index bae73ed8dde..b300259aef7 100644
--- a/apps/web/src/hooks/useStableCallback.ts
+++ b/apps/web/src/hooks/useStableCallback.ts
@@ -7,6 +7,7 @@ export function useStableCallback<Args extends ReadonlyArray<unknown>, Result>(
const latest = useRef(fn);
// Insertion effects run before every layout effect in the commit, so a
// child's layout effect already calls this render's fn.
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- updates the ref during commit, before any layout effect can call the stable callback
useInsertionEffect(() => {
latest.current = fn;
});
diff --git a/apps/web/src/hooks/useWorkspaceMutationRefresh.ts b/apps/web/src/hooks/useWorkspaceMutationRefresh.ts
index 1617ba500e9..b31a0773c4c 100644
--- a/apps/web/src/hooks/useWorkspaceMutationRefresh.ts
+++ b/apps/web/src/hooks/useWorkspaceMutationRefresh.ts
@@ -16,6 +16,7 @@ export function useWorkspaceMutationRefresh(input: {
const { enabled = true, mutationId, refresh, resourceKey } = input;
const handledTokenRef = useRef<string | null>(null);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- refetches the resource once per new workspace mutation token
useEffect(() => {
if (!enabled) return;
const token = workspaceMutationRefreshToken(resourceKey, mutationId);
diff --git a/apps/web/src/panelAnimations.ts b/apps/web/src/panelAnimations.ts
index aee2f7a0a6c..76b521ecb0f 100644
--- a/apps/web/src/panelAnimations.ts
+++ b/apps/web/src/panelAnimations.ts
@@ -12,7 +12,7 @@ export function usePanelNavigationSuppression(navigationKey: string): boolean {
const [paintedNavigationKey, setPaintedNavigationKey] = useState<string | null>(null);
const suppressed = paintedNavigationKey !== navigationKey;
- // 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.
+ // 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.
useEffect(() => {
if (!suppressed) return;
let releaseFrame = 0;
@@ -56,7 +56,7 @@ export function usePanelPresence<T>(
if (open && !present) setPresent(true);
if (!open && !animated && present) setPresent(false);
- // 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.
+ // 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.
useEffect(() => {
if (open || !animated) return;
const timeout = window.setTimeout(() => setPresent(false), durationMs);
diff --git a/apps/web/src/routes/__root.tsx b/apps/web/src/routes/__root.tsx
index 017b804dc5a..d05c664cb6d 100644
--- a/apps/web/src/routes/__root.tsx
+++ b/apps/web/src/routes/__root.tsx
@@ -366,6 +366,7 @@ function EventRouter({
})().catch(() => undefined);
});
+ // 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
useEffect(() => {
handleWelcome(serverWelcome);
}, [serverWelcome]);
diff --git a/apps/web/src/routes/_chat.index.tsx b/apps/web/src/routes/_chat.index.tsx
index d3c4922abcc..4b653e5e94f 100644
--- a/apps/web/src/routes/_chat.index.tsx
+++ b/apps/web/src/routes/_chat.index.tsx
@@ -47,6 +47,7 @@ function IndexDraftLanding() {
sortScopedProjectsForSidebar(projects, threads, "updated_at")[0] ?? null;
const attempt = startState.retryRequest;
+ // 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
useEffect(() => {
// Starting a draft after the user has left would replace the page they picked.
if (mostRecentProject === null || startedAttemptRef.current === attempt || !isStillOnIndex()) {
diff --git a/apps/web/src/shortcutModifierState.ts b/apps/web/src/shortcutModifierState.ts
index 359f86954bf..5a76d7f5087 100644
--- a/apps/web/src/shortcutModifierState.ts
+++ b/apps/web/src/shortcutModifierState.ts
@@ -31,6 +31,7 @@ export function useShortcutModifierState(ignoreEditable = false): ShortcutModifi
const [state, setState] = useState(EMPTY_SHORTCUT_MODIFIER_STATE);
const stateRef = useRef(EMPTY_SHORTCUT_MODIFIER_STATE);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window key, focus, paste and blur listeners that track held shortcut modifiers
useEffect(() => {
const updateState = (next: ShortcutModifierState) => {
if (areShortcutModifierStatesEqual(stateRef.current, next)) return;
diff --git a/apps/web/src/state/olderSettledShelf.ts b/apps/web/src/state/olderSettledShelf.ts
index ccbbe23f476..a903fd6d99b 100644
--- a/apps/web/src/state/olderSettledShelf.ts
+++ b/apps/web/src/state/olderSettledShelf.ts
@@ -36,6 +36,7 @@ export function useOlderSettledShelf(input: {
}));
const shelfKey = JSON.stringify(shelfScopes);
const shelf = useAtomValue(olderSettledThreads.shelfAtom(shelfScopes));
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- mounts the requested older settled pages into the thread family registry while shown
useEffect(() => {
const releases = (JSON.parse(shelfKey) as typeof shelfScopes).flatMap(({ scope, pages }) =>
pages === 0
@@ -89,6 +90,7 @@ export function useOlderSettledShelfGrowth(
visibleCount: shelf.visibleCount,
});
const { grow, pages } = shelf;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- requests more older settled pages when the listed threads cannot fill the visible count
useEffect(() => {
if (wanted !== pages) grow(wanted);
}, [wanted, pages, grow]);
diff --git a/apps/web/src/state/peerLinks.ts b/apps/web/src/state/peerLinks.ts
index c860a5d54e4..1d81a61fdaf 100644
--- a/apps/web/src/state/peerLinks.ts
+++ b/apps/web/src/state/peerLinks.ts
@@ -49,7 +49,7 @@ export function useLinkableMachines(environmentId: EnvironmentId, enabled: boole
const discoverIfUnasked = useEffectEvent(() => {
if (discovery.environments.size === 0 && !discovery.refreshing) void refreshDiscovery();
});
- // 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
+ // 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
useEffect(() => {
if (enabled) discoverIfUnasked();
}, [enabled]);
diff --git a/apps/web/src/state/queries.ts b/apps/web/src/state/queries.ts
index 4232b7e82bf..5a999922da3 100644
--- a/apps/web/src/state/queries.ts
+++ b/apps/web/src/state/queries.ts
@@ -82,6 +82,7 @@ const threadSearch = createThreadSearchResultsAtomFamily({
export function useDebouncedValue<A>(value: A, delayMs: number): A {
const [debounced, setDebounced] = useState(value);
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- debounce timer that publishes the value after delayMs
useEffect(() => {
const timer = window.setTimeout(() => {
setDebounced(value);
@@ -140,6 +141,7 @@ export function useThreadSearch(
: { query: "", matches: EMPTY_THREAD_SEARCH_MATCHES };
// The shown results' rows stay mounted until newer results replace them.
const shownKey = visible.query === "" ? null : searchKeyOf(visible.query);
+ // 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
useEffect(() => {
if (shownKey === null) return;
const environments = (JSON.parse(shownKey) as [ReadonlyArray<EnvironmentId>])[0];
diff --git a/apps/web/src/state/threads.ts b/apps/web/src/state/threads.ts
index 9d1a154255e..2734c5df58e 100644
--- a/apps/web/src/state/threads.ts
+++ b/apps/web/src/state/threads.ts
@@ -47,6 +47,7 @@ export function useThreadFamily(
environmentId: EnvironmentId | null,
rootThreadId: ThreadId | null,
): void {
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- mounts the subagent tree into the thread family registry while the caller shows it
useEffect(() => {
if (environmentId === null || rootThreadId === null) return;
return threadFamilies.mount(appAtomRegistry, environmentId, rootThreadId);
diff --git a/oxlint-plugin-t3code/index.ts b/oxlint-plugin-t3code/index.ts
index cf9c614c403..ed9532ff6c5 100644
--- a/oxlint-plugin-t3code/index.ts
+++ b/oxlint-plugin-t3code/index.ts
@@ -15,7 +15,7 @@ import noMobileUniwindThemeEscapeHatches from "./rules/no-mobile-uniwind-theme-e
import noAmbiguousDetailNavigation from "./rules/no-ambiguous-detail-navigation.ts";
import noMobilePullRequestGlyphLiterals from "./rules/no-mobile-pull-request-glyph-literals.ts";
import noNativeTitleTooltip from "./rules/no-native-title-tooltip.ts";
-import reactEffectBudget from "./rules/react-effect-budget.ts";
+import noUnreasonedStateSync from "./rules/no-unreasoned-state-sync.ts";
import requireRegisteredListScroll from "./rules/require-registered-list-scroll.ts";
import noOutsetStateIndicators from "./rules/no-outset-state-indicators.ts";
import noPollingLoopInTests from "./rules/no-polling-loop-in-tests.ts";
@@ -53,7 +53,7 @@ export default definePlugin({
"no-ambiguous-detail-navigation": noAmbiguousDetailNavigation,
"no-mobile-pull-request-glyph-literals": noMobilePullRequestGlyphLiterals,
"no-native-title-tooltip": noNativeTitleTooltip,
- "react-effect-budget": reactEffectBudget,
+ "no-unreasoned-state-sync": noUnreasonedStateSync,
"require-registered-list-scroll": requireRegisteredListScroll,
"no-outset-state-indicators": noOutsetStateIndicators,
"no-polling-loop-in-tests": noPollingLoopInTests,
diff --git a/oxlint-plugin-t3code/rules/no-unreasoned-state-sync.test.ts b/oxlint-plugin-t3code/rules/no-unreasoned-state-sync.test.ts
new file mode 100644
index 00000000000..b9f3f56429d
--- /dev/null
+++ b/oxlint-plugin-t3code/rules/no-unreasoned-state-sync.test.ts
@@ -0,0 +1,56 @@
+import { assert, describe } from "@effect/vitest";
+
+import { createOxlintRuleHarness } from "../test/utils.ts";
+
+const reports = (output: string) =>
+ output.match(/t3code\(no-unreasoned-state-sync\)/g)?.length ?? 0;
+const lint = (filename: string) =>
+ createOxlintRuleHarness("t3code/no-unreasoned-state-sync", { filename });
+
+const component = lint("apps/web/src/Panel.tsx");
+
+describe("t3code/no-unreasoned-state-sync", () => {
+ component.invalid(
+ "reports every effect hook, including member calls",
+ `import React, { useEffect } from "react";
+export function Panel() {
+ useEffect(() => {}, []);
+ React.useLayoutEffect(() => {});
+ React.useInsertionEffect(() => {});
+ return null;
+}
+`,
+ (output) => assert.strictEqual(reports(output), 3),
+ );
+
+ component.valid(
+ "ignores comments, strings and lookalike names",
+ `// useEffect(() => {}) in a comment
+/* React.useLayoutEffect(() => {}) */
+const label = "useEffect(() => {})";
+const pipeline = Effect.matchCauseEffect(effect, {});
+const alias = useEffect;
+`,
+ );
+
+ component.valid(
+ "accepts an effect whose suppression states its reason",
+ `export function Panel() {
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to the window's resize events
+ React.useEffect(() => {});
+ return null;
+}
+`,
+ );
+
+ for (const filename of [
+ "apps/web/src/Panel.test.tsx",
+ "apps/web/src/Panel.spec.tsx",
+ "apps/web/tests/Panel.tsx",
+ ]) {
+ lint(filename).valid(
+ `skips ${filename}`,
+ `export function Panel() { useEffect(() => {}); return null; }`,
+ );
+ }
+});
diff --git a/oxlint-plugin-t3code/rules/no-unreasoned-state-sync.ts b/oxlint-plugin-t3code/rules/no-unreasoned-state-sync.ts
new file mode 100644
index 00000000000..d7dfe0a671b
--- /dev/null
+++ b/oxlint-plugin-t3code/rules/no-unreasoned-state-sync.ts
@@ -0,0 +1,48 @@
+import { defineRule, type ESTree } from "@oxlint/plugins";
+import * as Option from "effect/Option";
+
+import { getPropertyName, unwrapExpression } from "../utils.ts";
+
+const EFFECT_HOOKS = new Set(["useEffect", "useLayoutEffect", "useInsertionEffect"]);
+const EFFECT_HOOK_TEXT = /use(?:Layout|Insertion)?Effect/;
+const TEST_FILE = /\.(?:test|spec)\.[cm]?[jt]sx?$|[\\/](?:tests?|__tests__)[\\/]/;
+
+const isEffectHookCall = (node: ESTree.CallExpression): boolean => {
+ const callee = unwrapExpression(node.callee);
+ if (Option.isNone(callee)) return false;
+ const expression = callee.value;
+ if (expression.type === "Identifier") return EFFECT_HOOKS.has(expression.name);
+ if (expression.type === "MemberExpression" && !expression.computed) {
+ return Option.exists(getPropertyName(expression.property), (name) => EFFECT_HOOKS.has(name));
+ }
+ return false;
+};
+
+// Every kept effect carries its reason in the suppression above it; t3code/require-suppression-reason
+// rejects a suppression that does not say why.
+export default defineRule({
+ meta: {
+ type: "suggestion",
+ docs: {
+ description:
+ "Report every React effect hook, the usual way state gets synchronized; one that stays says why.",
+ },
+ },
+ create(context) {
+ if (TEST_FILE.test(context.filename) || !EFFECT_HOOK_TEXT.test(context.sourceCode.text)) {
+ return {};
+ }
+ return {
+ CallExpression(node) {
+ if (!isEffectHookCall(node)) return;
+ context.report({
+ node,
+ message:
+ "First ask whether this is synchronization that belongs in render or in the handler that causes it. " +
+ "If an effect is the honest model, say why on the line above it: " +
+ "`// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- <why>`.",
+ });
+ },
+ };
+ },
+});
diff --git a/oxlint-plugin-t3code/rules/react-effect-budget.test.ts b/oxlint-plugin-t3code/rules/react-effect-budget.test.ts
deleted file mode 100644
index 1841ba350bd..00000000000
--- a/oxlint-plugin-t3code/rules/react-effect-budget.test.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-import { assert, describe } from "@effect/vitest";
-
-import budget from "../../scripts/effect-budget.json" with { type: "json" };
-import { createOxlintRuleHarness } from "../test/utils.ts";
-
-const [budgetedFile, allowed] = Object.entries(budget)[0]!;
-
-const component = (effects: number) => `import React, { useEffect } from "react";
-export function Panel() {
-${Array.from({ length: effects }, (_, index) => (index % 2 === 0 ? " useEffect(() => {}, []);" : " React.useLayoutEffect(() => {});")).join("\n")}
- return null;
-}
-`;
-
-const reports = (output: string) => output.match(/t3code\(react-effect-budget\)/g)?.length ?? 0;
-const lint = (filename: string) =>
- createOxlintRuleHarness("t3code/react-effect-budget", { filename });
-
-const budgeted = lint(budgetedFile);
-const unbudgeted = lint("apps/web/src/NotInTheBudget.tsx");
-
-describe("t3code/react-effect-budget", () => {
- budgeted.valid("passes a file at its budget", component(allowed));
-
- budgeted.invalid("reports only the calls past the budget", component(allowed + 2), (output) => {
- assert.strictEqual(reports(output), 2);
- assert.include(output, `has ${allowed + 2} React effects against a budget of ${allowed}`);
- });
-
- unbudgeted.invalid(
- "gives a file without an entry a budget of 0, counting member calls",
- `export function New() { React.useEffect(() => {}); return null; }`,
- (output) => {
- assert.strictEqual(reports(output), 1);
- assert.include(output, "has 1 React effect against a budget of 0");
- },
- );
-
- unbudgeted.valid(
- "ignores comments, strings and lookalike names",
- `// useEffect(() => {}) in a comment
-/* React.useLayoutEffect(() => {}) */
-const label = "useEffect(() => {})";
-const pipeline = Effect.matchCauseEffect(effect, {});
-const alias = useEffect;
-`,
- );
-
- unbudgeted.valid(
- "does not count an effect that states its reason",
- `export function New() {
- // oxlint-disable-next-line t3code/react-effect-budget -- subscribes to the window's resize events
- React.useEffect(() => {});
- return null;
-}
-`,
- );
-
- lint("apps/web/src/Panel.test.tsx").valid("skips test files", component(3));
-});
diff --git a/oxlint-plugin-t3code/rules/react-effect-budget.ts b/oxlint-plugin-t3code/rules/react-effect-budget.ts
deleted file mode 100644
index 231c7074575..00000000000
--- a/oxlint-plugin-t3code/rules/react-effect-budget.ts
+++ /dev/null
@@ -1,71 +0,0 @@
-import { defineRule, type ESTree } from "@oxlint/plugins";
-import * as Option from "effect/Option";
-
-import budget from "../../scripts/effect-budget.json" with { type: "json" };
-import { getPropertyName, unwrapExpression } from "../utils.ts";
-
-const BUDGET_FILE = "scripts/effect-budget.json";
-const EFFECT_HOOKS = new Set(["useEffect", "useLayoutEffect", "useInsertionEffect"]);
-const EFFECT_HOOK_TEXT = /use(?:Layout|Insertion)?Effect/;
-const UNBUDGETED_FILE = /\.test\.[cm]?[jt]sx?$|[\\/](?:test|__tests__)[\\/]/;
-const budgets: Readonly<Record<string, number>> = budget;
-const JUSTIFIED = /oxlint-disable-next-line[^\n]*t3code\/react-effect-budget\s+--\s*\S/;
-
-// An effect with a stated reason on the line above is a reviewed decision: it is not counted, and it
-// is always reported so that the suppression comment above it is used.
-const isJustified = (lines: ReadonlyArray<string>, line: number): boolean =>
- JUSTIFIED.test(lines[line - 2] ?? "");
-
-const isEffectHookCall = (node: ESTree.CallExpression): boolean => {
- const callee = unwrapExpression(node.callee);
- if (Option.isNone(callee)) return false;
- const expression = callee.value;
- if (expression.type === "Identifier") return EFFECT_HOOKS.has(expression.name);
- if (expression.type === "MemberExpression" && !expression.computed) {
- return Option.exists(getPropertyName(expression.property), (name) => EFFECT_HOOKS.has(name));
- }
- return false;
-};
-
-// Budget keys are repo-relative; matching on the path's end also works for files linted elsewhere.
-const budgetFor = (filename: string): number => {
- const normalized = filename.replaceAll("\\", "/");
- const key = Object.keys(budgets).find((file) => normalized.endsWith(`/${file}`));
- return key === undefined ? 0 : budgets[key]!;
-};
-
-export default defineRule({
- meta: {
- type: "suggestion",
- docs: {
- description: `Hold each file to the React effect hooks it is allowed in ${BUDGET_FILE}; a missing entry allows none.`,
- },
- },
- create(context) {
- if (UNBUDGETED_FILE.test(context.filename) || !EFFECT_HOOK_TEXT.test(context.sourceCode.text)) {
- return {};
- }
- const lines = context.sourceCode.text.split("\n");
- const calls: Array<ESTree.CallExpression> = [];
- const justified: Array<ESTree.CallExpression> = [];
- return {
- CallExpression(node) {
- if (!isEffectHookCall(node)) return;
- (isJustified(lines, node.loc.start.line) ? justified : calls).push(node);
- },
- "Program:exit"() {
- for (const node of justified) {
- context.report({ node, message: "A React effect with a stated reason." });
- }
- const allowed = budgetFor(context.filename);
- if (calls.length <= allowed) return;
- const message =
- `This file has ${calls.length} React ${calls.length === 1 ? "effect" : "effects"} against a budget of ${allowed}. ` +
- "First ask whether this is synchronization that belongs in render or in the handler that causes it. " +
- "If an effect is the honest model, say why on the line above it: " +
- "`// oxlint-disable-next-line t3code/react-effect-budget -- <why>`.";
- for (const node of calls.slice(allowed)) context.report({ node, message });
- },
- };
- },
-});
diff --git a/scripts/effect-budget.json b/scripts/effect-budget.json
deleted file mode 100644
index 50c665e65d6..00000000000
--- a/scripts/effect-budget.json
+++ /dev/null
@@ -1,436 +0,0 @@
-{
- "apps/mobile/src/App.tsx": 2,
- "apps/mobile/src/Stack.tsx": 1,
- "apps/mobile/src/components/ComposerAttachmentStrip.tsx": 2,
- "apps/mobile/src/components/ComposerContextAttachment.tsx": 1,
- "apps/mobile/src/components/ComposerEditor.tsx": 2,
- "apps/mobile/src/components/FilePreview.ios.tsx": 1,
- "apps/mobile/src/components/FilePreview.tsx": 1,
- "apps/mobile/src/components/FilePreviewModal.tsx": 5,
- "apps/mobile/src/components/MediaVideoPlayer.tsx": 2,
- "apps/mobile/src/components/PdfPreview.android.tsx": 1,
- "apps/mobile/src/components/ProjectFavicon.tsx": 1,
- "apps/mobile/src/components/VideoPreviewModal.ios.tsx": 6,
- "apps/mobile/src/components/VideoPreviewModal.tsx": 3,
- "apps/mobile/src/components/VideoThumbnailImage.tsx": 1,
- "apps/mobile/src/components/ui/AndroidAnchoredMenu.tsx": 1,
- "apps/mobile/src/components/ui/AppBar.android.tsx": 1,
- "apps/mobile/src/components/ui/Dialog.android.tsx": 1,
- "apps/mobile/src/components/ui/Notice.tsx": 1,
- "apps/mobile/src/components/ui/OverlayPortal.tsx": 3,
- "apps/mobile/src/components/ui/SliderRow.android.tsx": 1,
- "apps/mobile/src/components/ui/SliderRow.tsx": 1,
- "apps/mobile/src/components/ui/Toast.tsx": 2,
- "apps/mobile/src/features/agent-awareness/notificationNavigation.ts": 3,
- "apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx": 2,
- "apps/mobile/src/features/browser/PreviewStreamWebView.tsx": 5,
- "apps/mobile/src/features/browser/ThreadBrowserFloat.tsx": 2,
- "apps/mobile/src/features/cloud/CloudAuthProvider.tsx": 3,
- "apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx": 1,
- "apps/mobile/src/features/cloud/connectOnboardingNavigation.ts": 1,
- "apps/mobile/src/features/cloud/managedRelayState.ts": 1,
- "apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx": 5,
- "apps/mobile/src/features/connection/PermissionUpdateNotice.tsx": 2,
- "apps/mobile/src/features/devices/DevicePreviewRouteScreen.tsx": 6,
- "apps/mobile/src/features/devices/DeviceStreamWebView.tsx": 2,
- "apps/mobile/src/features/diagnostics/SettingsDiagnosticsRouteScreen.tsx": 1,
- "apps/mobile/src/features/diffs/nativeReviewDiffSurface.ts": 3,
- "apps/mobile/src/features/files/AttachmentFileScreen.tsx": 1,
- "apps/mobile/src/features/files/AudioFilePreview.tsx": 2,
- "apps/mobile/src/features/files/FileTreeBrowser.tsx": 3,
- "apps/mobile/src/features/files/FilesHeader.tsx": 1,
- "apps/mobile/src/features/files/SourceFileSurface.tsx": 1,
- "apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx": 1,
- "apps/mobile/src/features/files/WorkspaceFileWebPreview.tsx": 1,
- "apps/mobile/src/features/files/useFileTreeEntries.ts": 1,
- "apps/mobile/src/features/home/HomeRouteScreen.tsx": 2,
- "apps/mobile/src/features/home/HomeScreen.tsx": 4,
- "apps/mobile/src/features/home/ThreadListToolbar.tsx": 1,
- "apps/mobile/src/features/home/WorkspaceConnectionTitle.tsx": 2,
- "apps/mobile/src/features/home/home-list-options.ts": 1,
- "apps/mobile/src/features/home/home-route-visibility.ts": 1,
- "apps/mobile/src/features/home/thread-swipe-actions.tsx": 5,
- "apps/mobile/src/features/keyboard/CommandPalette.tsx": 2,
- "apps/mobile/src/features/keyboard/HardwareKeyboardCommandProvider.tsx": 1,
- "apps/mobile/src/features/keyboard/hardwareKeyboardCommands.ts": 1,
- "apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx": 3,
- "apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx": 1,
- "apps/mobile/src/features/layout/workspace-inspector-pane.tsx": 2,
- "apps/mobile/src/features/projects/AddProjectScreen.tsx": 2,
- "apps/mobile/src/features/prompt-links/usePromptLinkResolver.ts": 1,
- "apps/mobile/src/features/prompt-links/useThreadPromptLink.ts": 1,
- "apps/mobile/src/features/pull-requests/PullRequestFilterMenuContext.tsx": 1,
- "apps/mobile/src/features/pull-requests/PullRequestReviewersScreen.tsx": 1,
- "apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx": 4,
- "apps/mobile/src/features/pull-requests/PullRequestToolbar.android.tsx": 1,
- "apps/mobile/src/features/pull-requests/PullRequestsScreen.tsx": 1,
- "apps/mobile/src/features/pull-requests/guide/PullRequestGuideScreen.tsx": 1,
- "apps/mobile/src/features/pull-requests/usePullRequestDiff.ts": 1,
- "apps/mobile/src/features/pull-requests/usePullRequestEnvironmentFallback.ts": 1,
- "apps/mobile/src/features/pull-requests/usePullRequestFilesViewed.ts": 4,
- "apps/mobile/src/features/pull-requests/usePullRequestList.ts": 3,
- "apps/mobile/src/features/pull-requests/usePullRequestReviewDraft.ts": 1,
- "apps/mobile/src/features/review/ReviewSheet.tsx": 1,
- "apps/mobile/src/features/review/useNativeReviewDiffHighlighting.ts": 2,
- "apps/mobile/src/features/review/useReviewCommentSelectionController.ts": 2,
- "apps/mobile/src/features/review/useReviewDiffData.ts": 2,
- "apps/mobile/src/features/review/useReviewDiffPrewarming.ts": 1,
- "apps/mobile/src/features/review/useReviewSections.ts": 5,
- "apps/mobile/src/features/settings/OutdatedServerUpdateSection.tsx": 1,
- "apps/mobile/src/features/settings/SettingsAboutRouteScreen.tsx": 1,
- "apps/mobile/src/features/settings/SettingsAuthRouteScreen.tsx": 2,
- "apps/mobile/src/features/settings/SettingsEnvironmentDetailRouteScreen.tsx": 1,
- "apps/mobile/src/features/settings/SettingsMicrophoneRouteScreen.tsx": 1,
- "apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx": 2,
- "apps/mobile/src/features/settings/SettingsProjectOverviewRouteScreen.tsx": 1,
- "apps/mobile/src/features/settings/SettingsScheduledTasksRouteScreen.tsx": 2,
- "apps/mobile/src/features/settings/appearance/AppearancePreferencesProvider.tsx": 2,
- "apps/mobile/src/features/settings/components/BranchNamingSettings.tsx": 1,
- "apps/mobile/src/features/settings/components/SettingsLegalDocumentRouteScreen.tsx": 1,
- "apps/mobile/src/features/sharing/IncomingShareProvider.tsx": 4,
- "apps/mobile/src/features/showcase/ShowcaseCaptureCoordinator.tsx": 11,
- "apps/mobile/src/features/terminal/NativeTerminalSurface.tsx": 4,
- "apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx": 14,
- "apps/mobile/src/features/terminal/terminalLaunchContext.ts": 1,
- "apps/mobile/src/features/terminal/useTerminalGridSync.ts": 1,
- "apps/mobile/src/features/terminal/useTerminalLifecycle.ts": 1,
- "apps/mobile/src/features/threads/ComposerPopoverAnchor.android.tsx": 2,
- "apps/mobile/src/features/threads/ComposerPopoverAnchor.tsx": 1,
- "apps/mobile/src/features/threads/CopyTextButton.tsx": 1,
- "apps/mobile/src/features/threads/CustomSnoozeSheet.android.tsx": 1,
- "apps/mobile/src/features/threads/GitActionProgressOverlay.tsx": 1,
- "apps/mobile/src/features/threads/HtmlRenderWebView.tsx": 1,
- "apps/mobile/src/features/threads/McpAppFullscreenScreen.tsx": 1,
- "apps/mobile/src/features/threads/McpAppWebView.tsx": 7,
- "apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx": 2,
- "apps/mobile/src/features/threads/NewTaskDraftRouteScreen.tsx": 5,
- "apps/mobile/src/features/threads/NewTaskDraftScreen.tsx": 10,
- "apps/mobile/src/features/threads/NewTaskRouteScreen.tsx": 1,
- "apps/mobile/src/features/threads/QuestionAttachments.tsx": 2,
- "apps/mobile/src/features/threads/ThreadAgentsSheet.tsx": 1,
- "apps/mobile/src/features/threads/ThreadArrangementSheet.tsx": 3,
- "apps/mobile/src/features/threads/ThreadComposer.tsx": 6,
- "apps/mobile/src/features/threads/ThreadDetailScreen.tsx": 20,
- "apps/mobile/src/features/threads/ThreadFeed.tsx": 14,
- "apps/mobile/src/features/threads/ThreadGuestShareBar.tsx": 1,
- "apps/mobile/src/features/threads/ThreadInlineFilePreview.tsx": 2,
- "apps/mobile/src/features/threads/ThreadMarkdownImage.tsx": 3,
- "apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx": 3,
- "apps/mobile/src/features/threads/ThreadQueueControl.tsx": 2,
- "apps/mobile/src/features/threads/ThreadRouteScreen.tsx": 3,
- "apps/mobile/src/features/threads/ThreadScreenHost.tsx": 2,
- "apps/mobile/src/features/threads/ThreadSettingsSheet.tsx": 2,
- "apps/mobile/src/features/threads/UsageLimitRecoveryCard.tsx": 1,
- "apps/mobile/src/features/threads/floating-working-control.tsx": 2,
- "apps/mobile/src/features/threads/git/GitOverviewSheet.tsx": 1,
- "apps/mobile/src/features/threads/new-task-flow-provider.tsx": 6,
- "apps/mobile/src/features/threads/thread-inspector-content-stack.tsx": 1,
- "apps/mobile/src/features/threads/thread-list-v2-items.tsx": 1,
- "apps/mobile/src/features/threads/thread-subagent-group.tsx": 2,
- "apps/mobile/src/features/threads/thread-work-log.tsx": 5,
- "apps/mobile/src/features/threads/use-composer-command-menu.ts": 5,
- "apps/mobile/src/features/threads/use-thread-settings-sheet-presentation.ts": 2,
- "apps/mobile/src/features/threads/use-visible-second-clock.ts": 2,
- "apps/mobile/src/features/threads/use-worktree-setup.ts": 1,
- "apps/mobile/src/features/threads/useFileChipShare.ts": 2,
- "apps/mobile/src/features/usage/UsageLimitsSection.tsx": 1,
- "apps/mobile/src/features/usage/UsageRouteScreen.tsx": 1,
- "apps/mobile/src/features/voice-input/ComposerDictationControl.tsx": 3,
- "apps/mobile/src/features/voice-input/GlobalVoiceInputControl.tsx": 2,
- "apps/mobile/src/features/voice-input/VoiceInputProvider.tsx": 4,
- "apps/mobile/src/features/voice-input/useVoiceInputController.ts": 1,
- "apps/mobile/src/features/workspace/AndroidWorkspaceTabsProvider.tsx": 1,
- "apps/mobile/src/features/workspace/WorkspaceNativeTabs.ios.tsx": 1,
- "apps/mobile/src/features/workspace/WorkspaceTabsContext.tsx": 1,
- "apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx": 1,
- "apps/mobile/src/features/workspace/WorkspaceToolbar.tsx": 2,
- "apps/mobile/src/lib/useMediaVideoPlayback.ts": 1,
- "apps/mobile/src/lib/attachmentDocument.ts": 4,
- "apps/mobile/src/lib/useDelayedStatus.ts": 2,
- "apps/mobile/src/lib/useUiRuntimeMemoryWarningGc.ts": 1,
- "apps/mobile/src/lib/videoAudioSession.ts": 1,
- "apps/mobile/src/native/NativeHeaderToolbar.tsx": 2,
- "apps/mobile/src/native/NativeWorkspaceColumns.ios.tsx": 1,
- "apps/mobile/src/native/StackHeader.tsx": 2,
- "apps/mobile/src/native/T3ComposerEditor.ios.tsx": 2,
- "apps/mobile/src/native/T3ComposerEditor.native.tsx": 2,
- "apps/mobile/src/native/V5StackHeader.ios.tsx": 1,
- "apps/mobile/src/native/useRetryingImageSource.ts": 1,
- "apps/mobile/src/state/composer-attachment-uploads.ts": 2,
- "apps/mobile/src/state/mediaActions.ts": 1,
- "apps/mobile/src/state/olderSettledShelf.ts": 2,
- "apps/mobile/src/state/queries.ts": 2,
- "apps/mobile/src/state/thread-order.ts": 1,
- "apps/mobile/src/state/threads.ts": 1,
- "apps/mobile/src/state/use-composer-attachment-actions.ts": 1,
- "apps/mobile/src/state/use-composer-drafts.ts": 3,
- "apps/mobile/src/state/use-pull-to-refresh.ts": 1,
- "apps/mobile/src/state/use-selected-thread-git-actions.ts": 1,
- "apps/mobile/src/state/use-selected-thread-requests.ts": 2,
- "apps/mobile/src/state/use-thread-composer-state.ts": 3,
- "apps/mobile/src/state/use-thread-outbox-drain.ts": 4,
- "apps/mobile/src/state/use-thread-pr.ts": 1,
- "apps/mobile/src/state/use-vcs-action-state.ts": 1,
- "apps/mobile/src/widgets/SubscriptionUsageCoordinator.tsx": 1,
- "apps/mobile/src/widgets/useSubscriptionUsage.ts": 1,
- "apps/web/src/AppRoot.tsx": 1,
- "apps/web/src/browser/BrowserProfileReporter.tsx": 1,
- "apps/web/src/browser/BrowserSurfaceSlot.tsx": 2,
- "apps/web/src/browser/ElectronBrowserHost.tsx": 3,
- "apps/web/src/browser/HostedBrowserWebview.tsx": 6,
- "apps/web/src/browser/ServerBrowserSurface.tsx": 5,
- "apps/web/src/browser/useBrowserViewportResize.ts": 2,
- "apps/web/src/cloud/managedAuth.tsx": 2,
- "apps/web/src/cloud/managedRelayState.ts": 2,
- "apps/web/src/components/AddProjectToMachineDialog.tsx": 1,
- "apps/web/src/components/AnimatedHeight.tsx": 2,
- "apps/web/src/components/AnimatedWidth.tsx": 1,
- "apps/web/src/components/AppSidebarLayout.tsx": 4,
- "apps/web/src/components/BackgroundThreadAnnouncer.tsx": 1,
- "apps/web/src/components/BranchPicker.tsx": 2,
- "apps/web/src/components/BranchToolbar.tsx": 4,
- "apps/web/src/components/BranchToolbarBranchSelector.tsx": 1,
- "apps/web/src/components/ChatMarkdown.tsx": 1,
- "apps/web/src/components/ChatView.tsx": 23,
- "apps/web/src/components/CommandPalette.tsx": 5,
- "apps/web/src/components/CommandPaletteContent.tsx": 1,
- "apps/web/src/components/ComposerPromptEditorTiptap.tsx": 13,
- "apps/web/src/components/ConfirmDialogHost.tsx": 1,
- "apps/web/src/components/CustomSnoozeDialog.tsx": 1,
- "apps/web/src/components/DiffPanel.tsx": 4,
- "apps/web/src/components/DiffWorkerPoolProvider.tsx": 2,
- "apps/web/src/components/GitActionsControl.tsx": 4,
- "apps/web/src/components/HostFreezeToastCoordinator.tsx": 1,
- "apps/web/src/components/LegacySidebar.tsx": 5,
- "apps/web/src/components/LegacyThreadMigrationToast.tsx": 2,
- "apps/web/src/components/PermissionUpdateNotice.tsx": 1,
- "apps/web/src/components/PersistentThreadTerminals.tsx": 1,
- "apps/web/src/components/ProjectCloneToastCoordinator.tsx": 2,
- "apps/web/src/components/PullRequestThreadDialog.tsx": 1,
- "apps/web/src/components/QuitHoldOverlay.tsx": 1,
- "apps/web/src/components/ReopenClosedViewShortcut.tsx": 2,
- "apps/web/src/components/RightPanelTabs.tsx": 5,
- "apps/web/src/components/Sidebar.logic.ts": 2,
- "apps/web/src/components/Sidebar.pointer.ts": 1,
- "apps/web/src/components/Sidebar.tsx": 10,
- "apps/web/src/components/SlowRpcRequestToastCoordinator.tsx": 2,
- "apps/web/src/components/ThreadNotificationCoordinator.tsx": 5,
- "apps/web/src/components/ThreadRouteView.tsx": 5,
- "apps/web/src/components/ThreadTerminalDrawer.tsx": 13,
- "apps/web/src/components/auth/ConnectAgentSurface.tsx": 1,
- "apps/web/src/components/auth/PairingRouteSurface.tsx": 2,
- "apps/web/src/components/chat/AgentElapsed.tsx": 1,
- "apps/web/src/components/chat/AssistantCitationChip.tsx": 2,
- "apps/web/src/components/chat/AssistantCitationSource.tsx": 1,
- "apps/web/src/components/chat/AssistantSelectionToolbar.tsx": 2,
- "apps/web/src/components/chat/ChangedFilesTree.tsx": 1,
- "apps/web/src/components/chat/ChatCanvas.tsx": 1,
- "apps/web/src/components/chat/ChatComposer.tsx": 26,
- "apps/web/src/components/chat/ChatHeader.tsx": 2,
- "apps/web/src/components/chat/ChatMarkdownMedia.tsx": 1,
- "apps/web/src/components/chat/ChatOverlayHosts.tsx": 1,
- "apps/web/src/components/chat/CommandOutputPanel.tsx": 1,
- "apps/web/src/components/chat/ComposerAttachmentStrip.tsx": 1,
- "apps/web/src/components/chat/ComposerBannerStack.tsx": 3,
- "apps/web/src/components/chat/ComposerCommandMenu.tsx": 1,
- "apps/web/src/components/chat/ComposerCommandMenuLayer.tsx": 1,
- "apps/web/src/components/chat/ComposerImageThumbnail.tsx": 1,
- "apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx": 2,
- "apps/web/src/components/chat/ComposerStashMenu.tsx": 2,
- "apps/web/src/components/chat/DraftHeroHeadline.tsx": 1,
- "apps/web/src/components/chat/DraftHeroProjectHeading.tsx": 1,
- "apps/web/src/components/chat/ExpandedImageDialog.tsx": 4,
- "apps/web/src/components/chat/HtmlRenderFrame.tsx": 3,
- "apps/web/src/components/chat/MarkdownCodeBlock.tsx": 3,
- "apps/web/src/components/chat/MarkdownTable.tsx": 3,
- "apps/web/src/components/chat/McpAppFrame.tsx": 10,
- "apps/web/src/components/chat/MermaidDiagram.tsx": 1,
- "apps/web/src/components/chat/MessagesTimeline.tsx": 10,
- "apps/web/src/components/chat/ModelPickerContent.tsx": 4,
- "apps/web/src/components/chat/ModelPickerSidebar.tsx": 1,
- "apps/web/src/components/chat/OpenInPicker.tsx": 1,
- "apps/web/src/components/chat/OpenInPickerShortcut.ts": 1,
- "apps/web/src/components/chat/PierreEntryIcon.tsx": 1,
- "apps/web/src/components/chat/ProviderModelPicker.tsx": 1,
- "apps/web/src/components/chat/ProviderSubagentBar.tsx": 1,
- "apps/web/src/components/chat/ThreadActivityAnnouncer.tsx": 1,
- "apps/web/src/components/chat/ThreadDetailsCard.tsx": 4,
- "apps/web/src/components/chat/ThreadFindBar.tsx": 1,
- "apps/web/src/components/chat/ThreadFindProvider.tsx": 1,
- "apps/web/src/components/chat/ThreadTimeline.tsx": 1,
- "apps/web/src/components/chat/ThreadVisitWatermark.tsx": 2,
- "apps/web/src/components/chat/TimelineMinimap.tsx": 1,
- "apps/web/src/components/chat/TimelineWorkGroupRows.tsx": 3,
- "apps/web/src/components/chat/UsageLimitRecoveryBanner.tsx": 1,
- "apps/web/src/components/chat/WorkLog.tsx": 1,
- "apps/web/src/components/chat/WorktreeSetupCard.tsx": 1,
- "apps/web/src/components/chat/ZoomableImage.tsx": 3,
- "apps/web/src/components/chat/composerContextUndo.ts": 1,
- "apps/web/src/components/chat/threadContextDrag.ts": 1,
- "apps/web/src/components/chat/threadFindHighlights.ts": 3,
- "apps/web/src/components/chat/useAssistantCitationTarget.ts": 2,
- "apps/web/src/components/chat/useAttachmentPreviewHandoff.ts": 4,
- "apps/web/src/components/chat/useChatShortcuts.ts": 1,
- "apps/web/src/components/chat/useComposerCommandKey.ts": 1,
- "apps/web/src/components/chat/useComposerMultilinePrompt.ts": 1,
- "apps/web/src/components/chat/useComposerRestingTransition.ts": 5,
- "apps/web/src/components/chat/useComposerSend.ts": 1,
- "apps/web/src/components/chat/useComposerStash.ts": 2,
- "apps/web/src/components/chat/useComposerTypingGuard.ts": 1,
- "apps/web/src/components/chat/useDraftEnvironmentRouting.ts": 3,
- "apps/web/src/components/chat/useDraftHeroLayoutTransition.ts": 1,
- "apps/web/src/components/chat/usePasteToFocusComposer.ts": 1,
- "apps/web/src/components/chat/usePendingThreadRequests.ts": 2,
- "apps/web/src/components/chat/useProviderWorkspaceSnapshotRefresh.ts": 2,
- "apps/web/src/components/chat/useQueuedRunEdit.ts": 1,
- "apps/web/src/components/chat/useRestingComposerControlsLayout.ts": 1,
- "apps/web/src/components/chat/useRightPanelActions.ts": 1,
- "apps/web/src/components/chat/useSystemComposerBanners.tsx": 1,
- "apps/web/src/components/chat/useThreadFind.ts": 6,
- "apps/web/src/components/chat/useThreadFindNavigation.ts": 5,
- "apps/web/src/components/chat/useThreadFindPositionReader.ts": 1,
- "apps/web/src/components/chat/useThreadLifecycle.tsx": 1,
- "apps/web/src/components/chat/useTimelineFollow.ts": 6,
- "apps/web/src/components/chat/useTimelinePositionRestore.ts": 2,
- "apps/web/src/components/cloud/CloudEnvironmentConnectList.tsx": 3,
- "apps/web/src/components/cloud/ConnectCliAuthSurface.tsx": 1,
- "apps/web/src/components/contextChipParts.tsx": 1,
- "apps/web/src/components/desktop/DesktopAppActivationCoordinator.tsx": 1,
- "apps/web/src/components/desktop/DesktopWebLinkCoordinator.tsx": 1,
- "apps/web/src/components/desktop/SnapShotCoordinator.tsx": 2,
- "apps/web/src/components/desktop/SshPasswordPromptDialog.tsx": 3,
- "apps/web/src/components/device/DeviceAndroidFoldControls.tsx": 2,
- "apps/web/src/components/device/DeviceDuoViewport.tsx": 4,
- "apps/web/src/components/device/DevicePanel.tsx": 1,
- "apps/web/src/components/device/DevicePhoneViewport.tsx": 3,
- "apps/web/src/components/device/DeviceSetup.tsx": 1,
- "apps/web/src/components/device/DeviceStreamView.tsx": 4,
- "apps/web/src/components/device/DeviceToolsPanel.tsx": 1,
- "apps/web/src/components/device/DeviceWorkspace.tsx": 1,
- "apps/web/src/components/device/useDeviceControls.ts": 2,
- "apps/web/src/components/diffs/DiffCommentAnnotation.tsx": 1,
- "apps/web/src/components/diffs/DiffFileLoadingBoundary.tsx": 1,
- "apps/web/src/components/diffs/DiffFileTree.tsx": 3,
- "apps/web/src/components/diffs/useCodeViewFileReveal.ts": 1,
- "apps/web/src/components/diffs/useReviewFilePatches.ts": 1,
- "apps/web/src/components/files/AttachmentFilePreview.tsx": 3,
- "apps/web/src/components/files/BrowserDocumentFrame.tsx": 7,
- "apps/web/src/components/files/FileBrowserPanel.tsx": 9,
- "apps/web/src/components/files/FilePreviewPanel.tsx": 3,
- "apps/web/src/components/files/InlineAudioPreview.tsx": 1,
- "apps/web/src/components/files/useDirectoryEntries.ts": 1,
- "apps/web/src/components/files/useFileSaveCoordinator.ts": 2,
- "apps/web/src/components/guest/GuestHtmlRender.tsx": 3,
- "apps/web/src/components/guest/GuestPage.tsx": 7,
- "apps/web/src/components/media/AttachmentImage.tsx": 1,
- "apps/web/src/components/media/MediaVideoPlayer.tsx": 2,
- "apps/web/src/components/onboarding/FirstRunGate.tsx": 3,
- "apps/web/src/components/onboarding/WelcomeWizard.tsx": 7,
- "apps/web/src/components/permissions/usePermissionStatus.ts": 1,
- "apps/web/src/components/preview/AgentBrowserCursor.tsx": 1,
- "apps/web/src/components/preview/PreviewChromeRow.tsx": 1,
- "apps/web/src/components/preview/PreviewPanelShell.tsx": 3,
- "apps/web/src/components/preview/PreviewView.tsx": 7,
- "apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx": 3,
- "apps/web/src/components/preview/ZoomIndicator.tsx": 1,
- "apps/web/src/components/preview/useAgentOpenedPreviews.ts": 3,
- "apps/web/src/components/preview/usePreviewBridge.ts": 2,
- "apps/web/src/components/projectScriptEditor.tsx": 1,
- "apps/web/src/components/promptLinks/HostedPromptLinkLanding.tsx": 1,
- "apps/web/src/components/promptLinks/NewThreadLinkView.tsx": 2,
- "apps/web/src/components/promptLinks/ThreadLinkPrompt.tsx": 1,
- "apps/web/src/components/pullRequest/LinkPullRequestDialog.tsx": 1,
- "apps/web/src/components/pullRequest/PullRequestCodeTab.tsx": 5,
- "apps/web/src/components/pullRequest/PullRequestCommentBody.tsx": 1,
- "apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx": 5,
- "apps/web/src/components/pullRequest/PullRequestGuideTab.tsx": 2,
- "apps/web/src/components/pullRequest/PullRequestsColumn.tsx": 5,
- "apps/web/src/components/pullRequest/PullRequestsPage.tsx": 9,
- "apps/web/src/components/pullRequest/guide/GuideTour.tsx": 1,
- "apps/web/src/components/pullRequest/guide/PullRequestGuideRunCoordinator.tsx": 2,
- "apps/web/src/components/pullRequest/guide/useReviewGuideWriter.ts": 1,
- "apps/web/src/components/pullRequest/useInlineActionConfirm.ts": 1,
- "apps/web/src/components/pullRequest/usePullRequestDetail.ts": 1,
- "apps/web/src/components/pullRequest/usePullRequestFilesViewed.ts": 2,
- "apps/web/src/components/pullRequest/usePullRequestListView.ts": 1,
- "apps/web/src/components/pullRequest/useThreadLinkedPullRequest.ts": 1,
- "apps/web/src/components/search/ProjectContentSearchDialog.tsx": 1,
- "apps/web/src/components/settings/AcpRegistryIcon.tsx": 1,
- "apps/web/src/components/settings/AcpRegistrySearchStep.tsx": 2,
- "apps/web/src/components/settings/AddCodexAccountDialog.tsx": 1,
- "apps/web/src/components/settings/AddEnvironmentDialog.tsx": 1,
- "apps/web/src/components/settings/CliCommandSettingsRow.tsx": 1,
- "apps/web/src/components/settings/CodexSetupSection.tsx": 6,
- "apps/web/src/components/settings/ConnectionDiagnosisDetails.tsx": 1,
- "apps/web/src/components/settings/DiagnosticsSettings.tsx": 2,
- "apps/web/src/components/settings/EasDeviceHostsSettings.tsx": 1,
- "apps/web/src/components/settings/FontFamilyPicker.tsx": 2,
- "apps/web/src/components/settings/OpenSourceLicenses.tsx": 1,
- "apps/web/src/components/settings/ProjectFaviconThumbnail.tsx": 1,
- "apps/web/src/components/settings/ProjectIconPickerDialog.tsx": 1,
- "apps/web/src/components/settings/ProjectSettingsPanel.tsx": 2,
- "apps/web/src/components/settings/ProviderAccentColorPicker.tsx": 3,
- "apps/web/src/components/settings/ProviderAuthCallbackCoordinator.tsx": 1,
- "apps/web/src/components/settings/ProviderAuthTerminal.tsx": 2,
- "apps/web/src/components/settings/ProviderInstanceCard.tsx": 1,
- "apps/web/src/components/settings/ProviderModelsSection.tsx": 1,
- "apps/web/src/components/settings/ProviderSettingsForm.tsx": 1,
- "apps/web/src/components/settings/ResourceTelemetryDiagnostics.tsx": 2,
- "apps/web/src/components/settings/SavedEnvironmentRows.tsx": 1,
- "apps/web/src/components/settings/ScheduledTasksSettings.tsx": 2,
- "apps/web/src/components/settings/SettingsFontPreviews.tsx": 5,
- "apps/web/src/components/settings/SettingsPanels.tsx": 1,
- "apps/web/src/components/settings/SettingsSidebarNav.tsx": 3,
- "apps/web/src/components/settings/SnapShotSettings.tsx": 4,
- "apps/web/src/components/settings/TelemetryExportSettings.tsx": 1,
- "apps/web/src/components/settings/ThemeColorPicker.tsx": 1,
- "apps/web/src/components/settings/ThemeEditorPanel.tsx": 5,
- "apps/web/src/components/settings/ThemeImportDialog.tsx": 1,
- "apps/web/src/components/settings/ThemeSearchSection.tsx": 3,
- "apps/web/src/components/settings/TypographySettings.tsx": 2,
- "apps/web/src/components/settings/settingsLayout.tsx": 1,
- "apps/web/src/components/settings/useSnapShotShortcutRecorder.tsx": 1,
- "apps/web/src/components/sidebar/SidebarProviderUpdatePill.tsx": 2,
- "apps/web/src/components/sidebar/SidebarThreadRow.tsx": 5,
- "apps/web/src/components/sidebar/SidebarThreadUndoNotice.tsx": 1,
- "apps/web/src/components/sidebar/SidebarUpdatePill.tsx": 1,
- "apps/web/src/components/sidebar/mainAppLocation.ts": 1,
- "apps/web/src/components/sidebar/updateEverythingRun.tsx": 2,
- "apps/web/src/components/ui/middle-truncate.tsx": 1,
- "apps/web/src/components/ui/sidebar.tsx": 3,
- "apps/web/src/components/ui/toast.tsx": 2,
- "apps/web/src/components/ui/tooltip.tsx": 1,
- "apps/web/src/components/usage/UsageLimits.tsx": 1,
- "apps/web/src/components/usage/UsageLimitsPooled.tsx": 1,
- "apps/web/src/components/usage/UsagePage.tsx": 3,
- "apps/web/src/components/usage/UsageProviderChart.tsx": 1,
- "apps/web/src/connection/useDesktopLocalBootstraps.ts": 1,
- "apps/web/src/hooks/FileMetadataThreadProvider.tsx": 1,
- "apps/web/src/hooks/useCopyToClipboard.ts": 1,
- "apps/web/src/hooks/useDefaultTheme.ts": 1,
- "apps/web/src/hooks/useDelayedStatus.ts": 2,
- "apps/web/src/hooks/useEnvironmentDisconnectDelay.ts": 1,
- "apps/web/src/hooks/useEnvironmentTheme.ts": 1,
- "apps/web/src/hooks/useLiveRefresh.ts": 1,
- "apps/web/src/hooks/useLiveRegion.ts": 1,
- "apps/web/src/hooks/useNavigateBack.ts": 1,
- "apps/web/src/hooks/usePreviewPanelInlineSize.ts": 1,
- "apps/web/src/hooks/useProactivePanels.ts": 1,
- "apps/web/src/hooks/useResizableWidth.ts": 2,
- "apps/web/src/hooks/useResizeDrag.ts": 2,
- "apps/web/src/hooks/useSettings.ts": 1,
- "apps/web/src/hooks/useStableCallback.ts": 1,
- "apps/web/src/hooks/useTheme.ts": 1,
- "apps/web/src/hooks/useThreadVisitedMigration.ts": 1,
- "apps/web/src/hooks/useWorkspaceMutationRefresh.ts": 1,
- "apps/web/src/panelAnimations.ts": 2,
- "apps/web/src/remoteOpen.ts": 1,
- "apps/web/src/routes/__root.tsx": 14,
- "apps/web/src/routes/_chat.index.tsx": 1,
- "apps/web/src/routes/_chat.tsx": 1,
- "apps/web/src/shortcutModifierState.ts": 1,
- "apps/web/src/state/olderSettledShelf.ts": 2,
- "apps/web/src/state/pullRequests.ts": 2,
- "apps/web/src/state/queries.ts": 2,
- "apps/web/src/state/threads.ts": 1
-}
diff --git a/vite.config.ts b/vite.config.ts
index 91ba06dc66b..15f7683c6dd 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -593,7 +593,7 @@ export default defineConfig({
},
{
files: ["apps/web/src/**", "apps/mobile/src/**", "packages/*/src/**"],
- rules: { "t3code/react-effect-budget": "error" },
+ rules: { "t3code/no-unreasoned-state-sync": "error" },
},
{
// React Compiler caches use* functions only if they call a hook.