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, 17:00 UTC
chore(lint): enforce react/immutability (#25115)
Julius Marminge committed
Oct 25, 2026 at 19:32 UTC
908226fc88e81750e4629830c43d336570c8045e
11 files changed
+37
-33
apps/mobile/src/features/layout/workspace-inspector-pane.tsx
+5
-7
@@ -36,14 +36,12 @@ export function WorkspaceInspectorPane(props: {
36
37
const onClosed = props.onClosed;
38
useEffect(() => {
39
- inspectorProgress.value = withTiming(
40
- inspectorVisible ? 1 : 0,
41
- WORKSPACE_PANE_TIMING,
42
- (finished) => {
39
+ inspectorProgress.set(
40
+ withTiming(inspectorVisible ? 1 : 0, WORKSPACE_PANE_TIMING, (finished) => {
41
if (finished === true && !inspectorVisible && onClosed !== undefined) {
42
runOnJS(onClosed)();
43
}
46
- },
44
+ }),
45
);
46
const targetWidth = inspectorVisible ? (inspectorWidth ?? 0) : 0;
47
renderedInspectorWidth.set(
@@ -61,10 +59,10 @@ export function WorkspaceInspectorPane(props: {
59
useEffect(() => {
60
const targetWidth = inspectorWidth ?? 0;
61
if (!inspectorVisible || resizing) {
64
- renderedContentWidth.value = targetWidth;
62
+ renderedContentWidth.set(targetWidth);
63
return;
64
}
67
- renderedContentWidth.value = withTiming(targetWidth, WORKSPACE_PANE_TIMING);
65
+ renderedContentWidth.set(withTiming(targetWidth, WORKSPACE_PANE_TIMING));
66
}, [inspectorVisible, inspectorWidth, renderedContentWidth, resizing]);
67
68
const inspectorStyle = useAnimatedStyle(
apps/mobile/src/features/threads/PendingUserInputCard.tsx
+2
-2
@@ -87,7 +87,7 @@ export function PendingUserInputCard(props: PendingUserInputCardProps) {
87
}
88
// The card resizes with the keyboard every frame, so easing each sample would leave the
89
// feed inset and floating controls trailing it.
90
- cardCoverage.value = Math.max(0, cardHeightRef.current - barHeightRef.current);
90
+ cardCoverage.set(Math.max(0, cardHeightRef.current - barHeightRef.current));
91
}, [cardCoverage]);
92
const handleBarLayout = useCallback(
93
(event: LayoutChangeEvent) => {
@@ -99,7 +99,7 @@ export function PendingUserInputCard(props: PendingUserInputCardProps) {
99
const handleCardLayout = useCallback(
100
(event: LayoutChangeEvent) => {
101
cardHeightRef.current = event.nativeEvent.layout.height;
102
- cardHeight.value = event.nativeEvent.layout.height;
102
+ cardHeight.set(event.nativeEvent.layout.height);
103
notifyCoverage();
104
},
105
[cardHeight, notifyCoverage],
apps/mobile/src/features/threads/ThreadComposer.tsx
+8
-6
@@ -385,12 +385,14 @@ export function ComposerSurface(props: {
385
const animatedBorderRadius = useSharedValue(targetBorderRadius);
386
const shouldAnimate = props.animateLayout !== false && Platform.OS !== "android";
387
useLayoutEffect(() => {
388
- animatedBorderRadius.value = shouldAnimate
389
- ? withTiming(targetBorderRadius, {
390
- duration: COMPOSER_TRANSITION_DURATION_MS,
391
- reduceMotion: ReduceMotion.System,
392
- })
393
- : targetBorderRadius;
388
+ animatedBorderRadius.set(
389
+ shouldAnimate
390
+ ? withTiming(targetBorderRadius, {
391
+ duration: COMPOSER_TRANSITION_DURATION_MS,
392
+ reduceMotion: ReduceMotion.System,
393
+ })
394
+ : targetBorderRadius,
395
+ );
396
}, [animatedBorderRadius, shouldAnimate, targetBorderRadius]);
397
const borderCurve = props.style.borderCurve;
398
const animatedShapeStyle = useAnimatedStyle(() => ({
apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+6
-4
@@ -968,9 +968,11 @@ export const ThreadDetailScreen = function ThreadDetailScreen(props: ThreadDetai
968
showFloatingStatus ? FLOATING_WORKING_CONTROL_COVERAGE : 0,
969
);
970
useEffect(() => {
971
- floatingControlCoverage.value = withTiming(
972
- showFloatingStatus ? FLOATING_WORKING_CONTROL_COVERAGE : 0,
973
- { duration: 180, reduceMotion: ReduceMotion.System },
971
+ floatingControlCoverage.set(
972
+ withTiming(showFloatingStatus ? FLOATING_WORKING_CONTROL_COVERAGE : 0, {
973
+ duration: 180,
974
+ reduceMotion: ReduceMotion.System,
975
+ }),
976
);
977
}, [floatingControlCoverage, showFloatingStatus]);
978
// Android measures its expanded card in-flow; only iOS needs extra overlay coverage.
@@ -984,7 +986,7 @@ export const ThreadDetailScreen = function ThreadDetailScreen(props: ThreadDetai
986
floatingControlCoverage.value +
987
(userInputCoverageApplies ? userInputInsetProgress.value * userInputCardCoverage.value : 0),
988
(value) => {
987
- combinedContentInsetEndAdjustment.value = value;
989
+ combinedContentInsetEndAdjustment.set(value);
990
},
991
[userInputCoverageApplies],
992
);
apps/mobile/src/features/threads/floating-working-control.tsx
+3
-3
@@ -105,7 +105,7 @@ export function FloatingWorkingControl(props: {
105
const separationProgress = useSharedValue(props.showScrollToEnd ? 1 : 0);
106
107
useEffect(() => {
108
- separationProgress.value = withTiming(props.showScrollToEnd ? 1 : 0, CONTROL_TIMING);
108
+ separationProgress.set(withTiming(props.showScrollToEnd ? 1 : 0, CONTROL_TIMING));
109
}, [props.showScrollToEnd, separationProgress]);
110
111
const lift = props.lift;
@@ -129,14 +129,14 @@ export function FloatingWorkingControl(props: {
129
}
130
const first = measuredWidthRef.current === null;
131
measuredWidthRef.current = width;
132
- capsuleWidth.value = first ? width : withTiming(width, CONTROL_TIMING);
132
+ capsuleWidth.set(first ? width : withTiming(width, CONTROL_TIMING));
133
};
134
const hasStatus = props.status !== null;
135
const hasCapsule = hasStatus || hasQueue || hasAgents || hasPreview;
136
useEffect(() => {
137
if (!hasStatus) {
138
measuredWidthRef.current = null;
139
- capsuleWidth.value = null;
139
+ capsuleWidth.set(null);
140
}
141
}, [capsuleWidth, hasStatus]);
142
const capsuleStyle = useAnimatedStyle(() => ({
apps/mobile/src/features/threads/thread-work-log.tsx
+6
-4
@@ -171,10 +171,12 @@ export function ThreadDisclosureChevron(props: {
171
const rotation = useSharedValue(props.expanded ? expandedAngle : 0);
172
173
useLayoutEffect(() => {
174
- rotation.value = withTiming(props.expanded ? expandedAngle : 0, {
175
- duration: THREAD_DISCLOSURE_TRANSITION_MS,
176
- reduceMotion: ReduceMotion.System,
177
- });
174
+ rotation.set(
175
+ withTiming(props.expanded ? expandedAngle : 0, {
176
+ duration: THREAD_DISCLOSURE_TRANSITION_MS,
177
+ reduceMotion: ReduceMotion.System,
178
+ }),
179
+ );
180
}, [expandedAngle, props.expanded, rotation]);
181
182
const rotationStyle = useAnimatedStyle(() => ({
apps/mobile/src/features/voice-input/ComposerDictationControl.tsx
+3
-3
@@ -90,7 +90,7 @@ export function ComposerDictationDraftContent(props: {
90
}) {
91
const rotation = useSharedValue(props.hidden ? 1 : 0);
92
useLayoutEffect(() => {
93
- rotation.value = withTiming(props.hidden ? 1 : 0, TOOLBAR_FLIP_TIMING);
93
+ rotation.set(withTiming(props.hidden ? 1 : 0, TOOLBAR_FLIP_TIMING));
94
}, [props.hidden, rotation]);
95
const compact = props.compact;
96
const animatedStyle = useAnimatedStyle(() => ({
@@ -263,7 +263,7 @@ function VoiceActionButton(props: {
263
const variant = props.variant ?? "plain";
264
const loadingVisibility = useSharedValue(props.loading ? 1 : 0);
265
useLayoutEffect(() => {
266
- loadingVisibility.value = withTiming(props.loading ? 1 : 0, DICTATION_TIMING);
266
+ loadingVisibility.set(withTiming(props.loading ? 1 : 0, DICTATION_TIMING));
267
}, [loadingVisibility, props.loading]);
268
const primaryStyle = useAnimatedStyle(() => ({ opacity: 1 - loadingVisibility.value }));
269
@@ -322,7 +322,7 @@ export function ComposerDictationStatus(props: {
322
}) {
323
const recordingVisibility = useSharedValue(props.phase === "recording" ? 1 : 0);
324
useLayoutEffect(() => {
325
- recordingVisibility.value = withTiming(props.phase === "recording" ? 1 : 0, DICTATION_TIMING);
325
+ recordingVisibility.set(withTiming(props.phase === "recording" ? 1 : 0, DICTATION_TIMING));
326
}, [props.phase, recordingVisibility]);
327
const waveformStyle = useAnimatedStyle(() => ({
328
opacity: recordingVisibility.value,
apps/mobile/src/features/voice-input/GlobalVoiceInputControl.tsx
+1
-1
@@ -65,7 +65,7 @@ function EdgeDictationPill(props: { readonly collapseRef: RefObject<(() => void)
65
const [expanded, setExpanded] = useState(false);
66
const progress = useSharedValue(0);
67
useEffect(() => {
68
- progress.value = withTiming(expanded ? 1 : 0, MORPH_TIMING);
68
+ progress.set(withTiming(expanded ? 1 : 0, MORPH_TIMING));
69
}, [expanded, progress]);
70
const { collapseRef } = props;
71
useEffect(() => {
apps/mobile/src/features/voice-input/VoiceInputProvider.tsx
+2
-2
@@ -195,7 +195,7 @@ function useVoiceInputRuntime() {
195
196
if (audioLevelsRef.current.some((level) => level !== 0)) {
197
audioLevelsRef.current = Array<number>(VOICE_WAVEFORM_SAMPLE_COUNT).fill(0);
198
- audioLevels.value = audioLevelsRef.current;
198
+ audioLevels.set(audioLevelsRef.current);
199
}
200
if (elapsedSecondsRef.current !== 0) {
201
elapsedSecondsRef.current = 0;
@@ -213,7 +213,7 @@ function useVoiceInputRuntime() {
213
if (level !== 0 || history.some((sample) => sample !== 0)) {
214
const nextLevels = [...history.slice(1), level];
215
audioLevelsRef.current = nextLevels;
216
- audioLevels.value = nextLevels;
216
+ audioLevels.set(nextLevels);
217
}
218
219
const nextElapsedSeconds = Math.min(
apps/mobile/src/reactCompilerCoverage.test.ts
-1
@@ -19,7 +19,6 @@ const KNOWN_BAILOUTS: Record<string, string> = {
19
"src/components/ui/Menu.tsx": "ref read during render",
20
"src/features/diffs/nativeReviewDiffSurface.ts": "ref read during render",
21
"src/features/home/thread-swipe-actions.tsx": "ref read during render",
22
- "src/features/threads/PendingUserInputCard.tsx": "mutates a frozen value",
22
"src/features/threads/ThreadArrangementSheet.tsx": "ref read during render",
23
"src/features/voice-input/VoiceInputProvider.tsx": "ref read during render",
24
"src/features/voice-input/useVoiceInputController.ts": "ref read during render",
vite.config.ts
+1
@@ -216,6 +216,7 @@ export default defineConfig({
216
perf: "warn",
217
},
218
rules: {
219
+ "react/immutability": "error",
220
"react/no-array-index-key": "error",
221
"react/no-unstable-nested-components": "error",
222
"react/static-components": "error",