Skip to content

Commit b6462c1

Browse files
Merge branch 'main' into fix/svg-file-viewer
2 parents d55aaab + 3a4d118 commit b6462c1

105 files changed

Lines changed: 7021 additions & 9545 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/release.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@ jobs:
297297
sudo sed -i 's|http://|https://|g' /etc/apt/blacksmith-ubuntu-mirrors.txt /etc/apt/sources.list.d/ubuntu.sources
298298
sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config build-essential
299299
300+
# The web package's browser project runs React tests in headless Chromium.
301+
- name: Install Chromium for web browser tests
302+
run: node apps/web/node_modules/playwright/cli.js install --with-deps --only-shell chromium
303+
300304
- name: Test
301305
run: vp run --parallel --concurrency-limit 4 --filter '!t3' --filter '!@t3tools/monorepo' test
302306

‎apps/mobile/app.config.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,10 @@ const config: ExpoConfig = {
489489
},
490490
},
491491
owner: "pingdotgg",
492+
experiments: {
493+
// Metro only runs babel-plugin-react-compiler when this is set; see src/reactCompilerCoverage.test.ts.
494+
reactCompiler: true,
495+
},
492496
};
493497

494498
export default config;

‎apps/mobile/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
"uniwind": "1.12.1"
141141
},
142142
"devDependencies": {
143+
"@babel/core": "^7.29.7",
143144
"@effect/vitest": "catalog:",
144145
"@pierre/trees": "1.0.0-beta.6",
145146
"@types/mdast": "^4.0.4",

‎apps/mobile/src/Stack.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,9 @@ function NotFoundScreen() {
669669

670670
const RootStackConfig = createWorkspaceStackNavigator({
671671
initialRouteName: "Home",
672-
layout: RootStackLayout,
672+
// React Navigation calls layouts as plain functions inside its own render. Passing a
673+
// compiled component directly would put its memo cache among the navigator's hooks.
674+
layout: (props) => <RootStackLayout {...props} />,
673675
screenOptions: {
674676
headerShown: false,
675677
},
@@ -1012,7 +1014,7 @@ export const RootStack = RootStackConfig.with(function AdaptiveRootStack({ Navig
10121014

10131015
return (
10141016
<Navigator
1015-
screenLayout={GuardedScreenLayout}
1017+
screenLayout={(props) => <GuardedScreenLayout {...props} />}
10161018
screenOptions={({ route }) => {
10171019
if (route.name !== "SettingsSheet" && route.name !== "NewTaskSheet") {
10181020
return {};

‎apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx‎

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScroll
33

44
import { useAuth } from "@clerk/expo";
55
import { StackActions, useNavigation } from "@react-navigation/native";
6-
import { useCallback, useEffect, useState } from "react";
6+
import { useEffect, useState } from "react";
77
import { Platform, Pressable, RefreshControl, View } from "react-native";
88
import { useSafeAreaInsets } from "react-native-safe-area-context";
99

@@ -49,32 +49,26 @@ function ConfiguredConnectOnboardingRouteScreen() {
4949
});
5050

5151
const [isRefreshing, setIsRefreshing] = useState(false);
52-
const handleRefresh = useCallback(() => {
53-
void (async () => {
54-
setIsRefreshing(true);
55-
try {
56-
await refreshRelayEnvironments();
57-
} finally {
58-
setIsRefreshing(false);
59-
}
60-
})();
61-
}, [refreshRelayEnvironments]);
52+
const handleRefresh = () => {
53+
setIsRefreshing(true);
54+
void refreshRelayEnvironments().finally(() => setIsRefreshing(false));
55+
};
6256

63-
const handleClose = useCallback(() => {
57+
const handleClose = () => {
6458
navigation.goBack();
65-
}, [navigation]);
59+
};
6660

6761
// Persist before dismissing so a quick sign-out/sign-in cannot race ahead
6862
// of the preference write; the write is a local secure-store update.
69-
const handleDontShowAgain = useCallback(() => {
63+
const handleDontShowAgain = () => {
7064
void (async () => {
7165
if (userId) {
7266
const result = await settlePromise(() => optOutOfConnectOnboarding(userId));
7367
reportAtomCommandResult(result, { label: "connect onboarding opt-out" });
7468
}
7569
navigation.goBack();
7670
})();
77-
}, [navigation, userId]);
71+
};
7872

7973
return (
8074
<View collapsable={false} className="flex-1 bg-sheet">

‎apps/mobile/src/features/devices/DevicePreviewRouteScreen.tsx‎

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
import { useIsFocused, useNavigation, type StaticScreenProps } from "@react-navigation/native";
88
import { EnvironmentId, ThreadId } from "@t3tools/contracts";
99
import * as Cause from "effect/Cause";
10-
import { useCallback, useEffect, useMemo, useRef, useState, type RefObject } from "react";
10+
import { useEffect, useRef, useState, type RefObject } from "react";
1111
import * as Haptics from "expo-haptics";
1212
import { Accelerometer } from "expo-sensors";
1313
import { AppState, BackHandler, Pressable, StatusBar, View } from "react-native";
@@ -47,7 +47,7 @@ type DevicePreviewRouteScreenProps = StaticScreenProps<{
4747

4848
export function DevicePreviewRouteScreen({ route }: DevicePreviewRouteScreenProps) {
4949
const navigation = useNavigation();
50-
const onClose = useCallback(() => navigation.goBack(), [navigation]);
50+
const onClose = () => navigation.goBack();
5151
const { environmentId, threadId } = route.params;
5252
const isBlankLink = environmentId.trim().length === 0 || threadId.trim().length === 0;
5353
useEffect(() => {
@@ -85,15 +85,12 @@ function DevicePreviewScreen({
8585
const shutdown = useAtomCommand(deviceEnvironment.shutdown, { reportFailure: false });
8686
const streamRef = useRef<DeviceStreamRef>(null);
8787
const state = useEnvironmentQuery(deviceEnvironment.state({ environmentId, input: {} }));
88-
const previews = useMemo(
89-
() => threadDevicePreviews(state.data, threadId),
90-
[state.data, threadId],
91-
);
88+
const previews = threadDevicePreviews(state.data, threadId);
9289
const preview = selectedThreadDevicePreview(previews, selectedKey);
93-
const onInputConnected = useCallback(async (connected: boolean) => {
90+
const onInputConnected = async (connected: boolean) => {
9491
setInputConnected(connected);
9592
if (connected) setControlsVisible(false);
96-
}, []);
93+
};
9794
useEffect(() => {
9895
const subscription = AppState.addEventListener("change", (state) =>
9996
setForeground(state !== "background"),
@@ -126,20 +123,16 @@ function DevicePreviewScreen({
126123
const shutDownDevice = async () => {
127124
if (!preview || shuttingDown) return;
128125
setShuttingDown(true);
129-
try {
130-
const result = await shutdown({
131-
environmentId,
132-
input: {
133-
hostId: preview.session.hostId,
134-
deviceId: preview.session.deviceId,
135-
platform: preview.session.platform,
136-
},
137-
});
138-
if (result._tag === "Failure") {
139-
Dialog.alert("Could not shut down device", String(Cause.squash(result.cause)));
140-
}
141-
} finally {
142-
setShuttingDown(false);
126+
const result = await shutdown({
127+
environmentId,
128+
input: {
129+
hostId: preview.session.hostId,
130+
deviceId: preview.session.deviceId,
131+
platform: preview.session.platform,
132+
},
133+
}).finally(() => setShuttingDown(false));
134+
if (result._tag === "Failure") {
135+
Dialog.alert("Could not shut down device", String(Cause.squash(result.cause)));
143136
}
144137
};
145138

@@ -377,10 +370,7 @@ function OpenDevicePreview({
377370
const { session } = preview;
378371
const { themeVariables } = useAppearancePreferences();
379372
const { access, error, refresh } = useDeviceHubAccess(environmentId, session.hostId);
380-
const onUnauthorized = useCallback(
381-
async () => refreshDeviceHubAccess(environmentId),
382-
[environmentId],
383-
);
373+
const onUnauthorized = async () => refreshDeviceHubAccess(environmentId);
384374
useEffect(() => {
385375
refreshDeviceHubAccess(environmentId);
386376
return () => void onInputConnected(false);

‎apps/mobile/src/features/devices/DeviceStreamWebView.tsx‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
useEffectEvent,
55
useImperativeHandle,
66
useLayoutEffect,
7-
useMemo,
87
useRef,
98
useState,
109
type Ref,
@@ -112,14 +111,11 @@ function DeviceStreamDocumentView({
112111
const timer = setTimeout(bootstrapTimedOut, 15_000);
113112
return () => clearTimeout(timer);
114113
}, [started]);
115-
const source = useMemo(
116-
() => ({
117-
html: deviceStreamDocument(configuration, deviceStreamScript),
118-
// Android WebCodecs needs a secure document; streams still use the environment's URLs.
119-
baseUrl: Platform.OS === "android" ? "https://localhost/" : "file:///",
120-
}),
121-
[configuration],
122-
);
114+
const source = {
115+
html: deviceStreamDocument(configuration, deviceStreamScript),
116+
// Android WebCodecs needs a secure document; streams still use the environment's URLs.
117+
baseUrl: Platform.OS === "android" ? "https://localhost/" : "file:///",
118+
};
123119
const command = (button: keyof DeviceStreamRef) => {
124120
webView.current?.injectJavaScript(
125121
`window.T3DeviceStream?.command(${JSON.stringify(button)}); true;`,

‎apps/mobile/src/features/threads/thread-list-v2-items.tsx‎

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -605,21 +605,28 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
605605
const handleArchive = useCallback(() => onArchiveThread(thread), [onArchiveThread, thread]);
606606

607607
const canUnsettle = variant === "slim";
608-
const [snoozeGateTick, bumpSnoozeGateTick] = useState(0);
608+
// The React Compiler caches render results on props and state, so a clock read
609+
// in render would stay frozen until `thread` changes: the gate could never
610+
// expire and its timer would re-fire every 50ms. The gate's clock is state.
611+
const [snoozeGateClock, setSnoozeGateClock] = useState(() => ({ thread, now: Date.now() }));
612+
if (snoozeGateClock.thread !== thread) setSnoozeGateClock({ thread, now: Date.now() });
613+
const snoozeGateNow = new Date(snoozeGateClock.now).toISOString();
609614
const snoozeGateExpiryMs = props.snoozeSupported
610-
? resolveThreadListV2SnoozeGateExpiryMs(thread, { now: new Date().toISOString() })
615+
? resolveThreadListV2SnoozeGateExpiryMs(thread, { now: snoozeGateNow })
611616
: null;
612617
useEffect(() => {
613-
if (snoozeGateExpiryMs === null) return;
614-
const delayMs = Math.min(Math.max(0, snoozeGateExpiryMs - Date.now()) + 50, 2_147_483_647);
615-
const id = setTimeout(() => bumpSnoozeGateTick((tick) => tick + 1), delayMs);
618+
// A gate still closed past its expiry is held by runtime status, not time,
619+
// so no clock tick can open it.
620+
if (snoozeGateExpiryMs === null || snoozeGateExpiryMs <= snoozeGateClock.now) return;
621+
const delayMs = Math.min(snoozeGateExpiryMs - Date.now() + 50, 2_147_483_647);
622+
const id = setTimeout(() => setSnoozeGateClock({ thread, now: Date.now() }), delayMs);
616623
return () => clearTimeout(id);
617-
}, [snoozeGateExpiryMs, snoozeGateTick]);
624+
}, [snoozeGateExpiryMs, snoozeGateClock.now, thread]);
618625
const swipeActions = resolveThreadListV2SwipeActions({
619626
variant,
620627
settlementSupported: props.settlementSupported,
621628
snoozeSupported: props.snoozeSupported,
622-
snoozable: canSnooze(thread, { now: new Date().toISOString() }),
629+
snoozable: canSnooze(thread, { now: snoozeGateNow }),
623630
snoozed: snoozedRow,
624631
});
625632
const snoozePresets = useMemo(

‎apps/mobile/src/features/usage/UsageDailyChart.ios.tsx‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Chart, Host, type ChartDataPoint } from "@expo/ui/swift-ui";
22
import { frame } from "@expo/ui/swift-ui/modifiers";
3-
import { useMemo } from "react";
43

54
import type { DailyTotals } from "@t3tools/shared/usageMerge";
65

@@ -17,15 +16,13 @@ export interface UsageDailyChartProps {
1716
export function UsageDailyChart({ days, daily, metric, height }: UsageDailyChartProps) {
1817
const colors = useProviderColors();
1918

20-
const data = useMemo((): ChartDataPoint[] => {
21-
return buildChartDays(days, daily, metric).flatMap((day) =>
22-
day.values.map((entry) => ({
23-
x: day.day,
24-
y: entry.value,
25-
color: colors[entry.provider],
26-
})),
27-
);
28-
}, [days, daily, metric, colors]);
19+
const data: ChartDataPoint[] = buildChartDays(days, daily, metric).flatMap((day) =>
20+
day.values.map((entry) => ({
21+
x: day.day,
22+
y: entry.value,
23+
color: colors[entry.provider],
24+
})),
25+
);
2926

3027
return (
3128
<Host style={{ height, width: "100%" }}>

‎apps/mobile/src/features/usage/UsageDailyChart.tsx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { useMemo } from "react";
21
import { View } from "react-native";
32

43
import type { DailyTotals } from "@t3tools/shared/usageMerge";
@@ -15,7 +14,7 @@ export interface UsageDailyChartProps {
1514

1615
export function UsageDailyChart({ days, daily, metric, height }: UsageDailyChartProps) {
1716
const colors = useProviderColors();
18-
const chartDays = useMemo(() => buildChartDays(days, daily, metric), [days, daily, metric]);
17+
const chartDays = buildChartDays(days, daily, metric);
1918
const max = chartDays.reduce((peak, day) => Math.max(peak, day.total), 0);
2019

2120
return (

0 commit comments

Comments
 (0)