@devries-cameron20 / t3code Mirror · read-only / commits / 85f17ea246
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 15:45 UTC

chore(lint): enforce react/exhaustive-effect-dependencies (#25118)

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

Julius Marminge committed Oct 25, 2026 at 21:45 UTC 85f17ea2465c185ef63944b9a488413571414f94
23 files changed +50 -13
apps/mobile/src/components/ComposerEditor.tsx
+1
@@ -79,6 +79,7 @@ export function ComposerEditor({
79 () => () => {
80 importRef.current?.abort();
81 },
82 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- Switching drafts aborts an import owned by the previous draft.
83 [draftKey],
84 );
85 const pasteContext = async (
apps/mobile/src/components/MediaVideoPlayer.tsx
+1
@@ -102,6 +102,7 @@ function LoadedMediaVideo(props: {
102 },
103 );
104 return () => controller.abort();
105 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- A play request or Retry (attempt) reloads the source into the same player.
106 }, [player, props.playRequested, attempt]);
107
108 return (
apps/mobile/src/components/VideoPreviewModal.tsx
+4 -2
@@ -87,6 +87,7 @@ function useLocalPlayback(source: LocalVideoPreviewSource): PlaybackState {
87 () => undefined,
88 );
89 };
90 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- A different attachment restarts the load even when it resolves to the same cached file URI.
91 }, [attachmentId, fileUri]);
92 const mimeType = videoMimeType(attachment) ?? attachment.mimeType;
93 return {
@@ -208,9 +209,10 @@ export function VideoPreviewModal(props: {
209 }) {
210 const isFocused = useIsFocused();
211 const hasSource = props.source !== null;
212 + const { onRequestClose } = props;
213 useEffect(() => {
212 - if (!isFocused && hasSource) props.onRequestClose();
213 - }, [isFocused, hasSource, props.onRequestClose]);
214 + if (!isFocused && hasSource) onRequestClose();
215 + }, [isFocused, hasSource, onRequestClose]);
216 const { source } = props;
217 if (source === null || !isFocused) return null;
218 return source.type === "local" ? (
apps/mobile/src/features/diffs/nativeReviewDiffSurface.ts
+1
@@ -263,6 +263,7 @@ function useNativeReviewDiffPayload(
263 cancelAnimationFrame(frame);
264 }
265 };
266 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- A new resetKey redelivers an unchanged payload after the diff surface resets.
267 }, [method, nativeRef, payload, resetKey, onFailure, onDelivered]);
268 }
269
apps/mobile/src/features/files/SourceFileSurface.tsx
+1
@@ -254,6 +254,7 @@ function JavaScriptSourceFileSurface(props: SourceFileSurfaceProps) {
254 listRef.current?.scrollToIndex({ index: targetIndex, animated: false, viewPosition: 0.3 });
255 });
256 return () => cancelAnimationFrame(frame);
257 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- Opening another file at the same line index scrolls the new file to it.
258 }, [props.path, targetIndex]);
259
260 const renderLine = ({ item, index }: { item: string; index: number }) => (
apps/mobile/src/features/home/HomeScreen.tsx
+1 -1
@@ -484,7 +484,7 @@ export function HomeScreen(props: HomeScreenProps) {
484 bumpSnoozeWakeTick((tick) => tick + 1);
485 }, delayMs);
486 return () => clearTimeout(id);
487 - // snoozeWakeTick re-arms clamped timers even when the wake date exceeds 32-bit setTimeout and stays unchanged.
487 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- snoozeWakeTick re-arms clamped timers even when the wake date exceeds 32-bit setTimeout and stays unchanged.
488 }, [nextSnoozeWakeAt, snoozeWakeTick]);
489 // Called as `props.onSelectThread(...)`, the compiler would cache this handler on the whole
490 // props object, which is new on every render of Home's parent.
apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
+1
@@ -148,6 +148,7 @@ export function useRegisterWorkspaceInspector(render: (() => ReactNode) | undefi
148 if (focusedRef.current) {
149 syncRegistration();
150 }
151 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- Changed pane content replaces its existing native workspace registration.
152 }, [wrappedRender]);
153
154 useEffect(
apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
+1 -1
@@ -389,7 +389,7 @@ export function PullRequestRouteScreen({ route }: StaticScreenProps<PullRequestP
389 currentScrollOffset.current = scrollOffsets.current.overview ?? -insets.top;
390 setSection("overview");
391 }
392 - }, [guidesEnabled, section, insets.top]);
392 + }, [guidesEnabled, section, insets.top, currentScrollOffset, requestedSection, scrollOffsets]);
393 const tabContent = activityContent;
394 const filesY = useRef(0);
395 const descriptionY = useRef(0);
apps/mobile/src/features/review/ReviewSheet.tsx
+1
@@ -453,6 +453,7 @@ export function ReviewSheet(props: ReviewSheetProps) {
453
454 useEffect(() => {
455 showAuxiliaryPane("inspector");
456 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- Opening review for another thread reselects its inspector pane.
457 }, [environmentId, showAuxiliaryPane, threadId]);
458 const {
459 error,
apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
+5 -2
@@ -513,6 +513,7 @@ export function NewTaskDraftScreen(props: {
513 projects,
514 flow.draftKey,
515 props.initialProjectRef,
516 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- Opening a draft from a share, pending task, or draft id re-resolves its project.
517 props.incomingShareId,
518 props.pendingTaskId,
519 props.draftId,
@@ -522,6 +523,7 @@ export function NewTaskDraftScreen(props: {
523 setProject,
524 ]);
525
526 + const { loadBranches } = flow;
527 useEffect(() => {
528 if (!selectedProject) {
529 loadedBranchesProjectKeyRef.current = null;
@@ -532,8 +534,8 @@ export function NewTaskDraftScreen(props: {
534 return;
535 }
536 loadedBranchesProjectKeyRef.current = projectKey;
535 - flow.loadBranches();
536 - }, [flow.loadBranches, selectedProject]);
537 + loadBranches();
538 + }, [loadBranches, selectedProject]);
539
540 useEffect(() => {
541 const shareId = props.incomingShareId;
@@ -745,6 +747,7 @@ export function NewTaskDraftScreen(props: {
747 consumeShare,
748 cancelledIncomingShareId,
749 flow.draftKey,
750 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- hasImportedIncomingShare reflects the draft store; a change re-checks whether the share still needs importing.
751 hasImportedIncomingShare,
752 incomingShare,
753 isIncomingShareInboxLoading,
apps/mobile/src/features/threads/ThreadArrangementSheet.tsx
+1
@@ -288,6 +288,7 @@ export function ThreadArrangementSheet(props: { onClose: () => void }) {
288 .map((row) => `${row.key}:${row.thread?.pinOrderKey}:${row.thread?.activeOrderKey}`)
289 .join("|");
290 useEffect(() => {
291 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- A changed thread order cancels the in-progress drag; stop only touches refs and state setters.
292 stop();
293 }, [orderVersion]);
294 useEffect(
apps/mobile/src/features/threads/ThreadComposer.tsx
+3 -2
@@ -764,11 +764,12 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
764 settingsSheetPresentation.open();
765 };
766
767 + const { present: presentSettingsRoute } = settingsRoutePresentation;
768 useEffect(() => {
769 if (settingsSheetPresentation.isActive) {
769 - settingsRoutePresentation.present(settingsRouteSession);
770 + presentSettingsRoute(settingsRouteSession);
771 }
771 - }, [settingsRoutePresentation.present, settingsRouteSession, settingsSheetPresentation.isActive]);
772 + }, [presentSettingsRoute, settingsRouteSession, settingsSheetPresentation.isActive]);
773
774 useEffect(() => {
775 if (!settingsSheetPresentation.isVisible || settingsRoutePresentedRef.current) {
apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+1
@@ -422,6 +422,7 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
422 }, []);
423 useEffect(() => {
424 setKeyboardStateSuspect(false);
425 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- Any keyboard visibility or height report clears the suspect flag set when the app resumed.
426 }, [isKeyboardVisible, liveKeyboardHeight]);
427 const handleOwnedInputFocusChange = (focused: boolean) => {
428 ownedInputFocusedRef.current = focused;
apps/mobile/src/features/threads/ThreadFeed.tsx
+2
@@ -2197,6 +2197,7 @@ export const ThreadFeed = memo(function ThreadFeed({
2197 props.threadId,
2198 props.contentPresentation.kind,
2199 ]);
2200 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- A scope change (thread or presentation) aborts the pending link lookup opened from the old scope.
2201 useLayoutEffect(() => () => markdownLinkRequest.current?.abort(), [markdownLinkScope]);
2202 const [preview, setPreview] = useState<{
2203 readonly scope: string;
@@ -2772,6 +2773,7 @@ export const ThreadFeed = memo(function ThreadFeed({
2773 // commit, and setEndFollow notifies the parent, so it can't run during render.
2774 useEffect(() => {
2775 if (jumpIndex !== null) landJump(jumpIndex);
2776 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- Jumping to a different message whose row index is unchanged must still land the jump.
2777 }, [jumpToMessageId, jumpIndex]);
2778
2779 const reflowLayout = () => ({
apps/mobile/src/features/threads/ThreadMarkdownImage.tsx
+2
@@ -50,10 +50,12 @@ export function ThreadMarkdownImageView(props: {
50
51 useEffect(() => {
52 setDecodedSize(null);
53 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- A new source invalidates the decoded image dimensions.
54 }, [props.sourceKey]);
55
56 useEffect(() => {
57 setFailedUri(null);
58 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- A new image URI clears the previous load failure.
59 }, [props.uri]);
60
61 const sourceSize = decodedSize ?? props.knownSize ?? null;
apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
+1 -1
@@ -330,7 +330,7 @@ function ThreadNavigationSidebarPane(
330 bumpSnoozeWakeTick((tick) => tick + 1);
331 }, delayMs);
332 return () => clearTimeout(id);
333 - // snoozeWakeTick re-arms clamped timers even when the wake date exceeds 32-bit setTimeout and stays unchanged.
333 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- snoozeWakeTick re-arms clamped timers even when the wake date exceeds 32-bit setTimeout and stays unchanged.
334 }, [nextSnoozeWakeAt, snoozeWakeTick]);
335 const listItems: readonly SidebarListItem[] =
336 settledShelfExpanded && threadListV2Layout.hiddenSettledCount > 0
apps/mobile/src/features/threads/use-composer-command-menu.ts
+1
@@ -337,6 +337,7 @@ export function useComposerCommandMenu({
337 else failedRefreshesRef.current = null;
338 }, retryLater);
339 }, [
340 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- Typing in the draft re-checks whether the provider workspace snapshot needs refreshing.
341 draftMessage,
342 environmentId,
343 projectCwd,
apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx
+1
@@ -119,6 +119,7 @@ export function WorkspaceToolbar(props: {
119 if (!tabActive) return;
120 const frame = requestAnimationFrame(restoreSearch);
121 return () => cancelAnimationFrame(frame);
122 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- Moving the search bar to the bottom toolbar restores its focus and query.
123 }, [restoreSearch, tabActive, bottomSearch]);
124 const composeButton = nativeToolbarCompose ? (
125 <Toolbar.Button
apps/mobile/src/native/T3ComposerEditor.ios.tsx
+9 -2
@@ -236,7 +236,7 @@ export function ComposerEditor({
236 nativeEventSnapshotsRef.current,
237 mostRecentEventCount,
238 );
239 - }, [acknowledgesLatestNativeEvent, mostRecentEventCount]);
239 + }, [acknowledgesLatestNativeEvent, mostRecentEventCount, nativeEventSnapshotsRef]);
240 const assumedValue = props.value;
241 useEffect(() => {
242 // Newer native events make this payload stale; do not record it as applied.
@@ -246,7 +246,14 @@ export function ComposerEditor({
246 controlledEventCount,
247 assumedValue,
248 );
249 - }, [assumedValue, controlledEventCount, isNativeEcho, controlledDocumentJson]);
249 + }, [
250 + assumedValue,
251 + controlledEventCount,
252 + isNativeEcho,
253 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- Every changed native payload, including selection-only changes, must update the assumed native snapshot.
254 + controlledDocumentJson,
255 + nativeEventSnapshotsRef,
256 + ]);
257 const acceptNativeEvent = useCallback(
258 (eventCount: number, value: string, nextSelection: ComposerEditorSelection) => {
259 const acknowledgedEventCount = acknowledgeComposerNativeEvent(
apps/mobile/src/native/T3ComposerEditor.native.tsx
+9 -2
@@ -233,7 +233,7 @@ export function ComposerEditor({
233 nativeEventSnapshotsRef.current,
234 mostRecentEventCount,
235 );
236 - }, [acknowledgesLatestNativeEvent, mostRecentEventCount]);
236 + }, [acknowledgesLatestNativeEvent, mostRecentEventCount, nativeEventSnapshotsRef]);
237 const assumedValue = props.value;
238 useEffect(() => {
239 // Newer native events make this payload stale; do not record it as applied.
@@ -243,7 +243,14 @@ export function ComposerEditor({
243 controlledEventCount,
244 assumedValue,
245 );
246 - }, [assumedValue, controlledEventCount, isNativeEcho, controlledDocumentJson]);
246 + }, [
247 + assumedValue,
248 + controlledEventCount,
249 + isNativeEcho,
250 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- Every changed native payload, including selection-only changes, must update the assumed native snapshot.
251 + controlledDocumentJson,
252 + nativeEventSnapshotsRef,
253 + ]);
254 const acceptNativeEvent = useCallback(
255 (eventCount: number, value: string, nextSelection: ComposerEditorSelection) => {
256 const acknowledgedEventCount = acknowledgeComposerNativeEvent(
apps/mobile/src/state/thread-order.ts
+1
@@ -25,6 +25,7 @@ export function usePendingThreadOrder(nowMinute: string, snoozeWakeTick: number)
25 // Clock-driven wakes can change membership without shell events; retire order holds and re-enable moves then.
26 useEffect(() => {
27 getPendingThreadOrder();
28 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- Clock ticks re-evaluate the external pending-order snapshot even without a shell event.
29 }, [nowMinute, snoozeWakeTick]);
30 return pending;
31 }
apps/mobile/src/state/use-thread-outbox-drain.ts
+1
@@ -1359,6 +1359,7 @@ export function useThreadOutboxDrain(): void {
1359 operableEnvironments,
1360 projects,
1361 queuedMessagesByThreadKey,
1362 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- retryTick re-runs the drain when a retry timer fires.
1363 retryTick,
1364 restoreQueuedMessage,
1365 scheduleQueuedMessageRetry,
vite.config.ts
+1
@@ -229,6 +229,7 @@ export default defineConfig({
229 "react/memo-dependencies": "error",
230 "react/purity": "error",
231 "react/refs": "error",
232 + "react/exhaustive-effect-dependencies": "error",
233 "react/immutability": "error",
234 "react/no-array-index-key": "error",
235 "react/no-unstable-nested-components": "error",