Skip to content

Commit 883f69d

Browse files
perf(mobile): home, workspace layout and overlay pieces compile with the React Compiler
HomeScreen, its connection title, list options and thread list actions, the adaptive workspace layout with its inspector pane and divider, and the OverlayPortal. try/finally became .finally() on the async body, refs read in render became state, layout effects or effect events, and a SharedValue prop is written with .set(). The thread list clock is state advanced by the minute interval and the snooze-wake timer, so compiled derivations never freeze it. Manual useMemo/useCallback/memo are gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent caf0c96 commit 883f69d

9 files changed

Lines changed: 912 additions & 1230 deletions

‎apps/mobile/src/components/ui/OverlayPortal.tsx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type ReactNode, useEffect, useRef, useState } from "react";
1+
import { type ReactNode, useEffect, useState } from "react";
22
import { View } from "react-native";
33

44
// AndroidAnchoredMenu projects its dropdown here instead of into an RN Modal: a Modal is a
@@ -8,6 +8,10 @@ type Entries = ReadonlyMap<number, ReactNode>;
88
type Listener = (entries: Entries) => void;
99

1010
let nextKey = 0;
11+
12+
function allocateKey() {
13+
return nextKey++;
14+
}
1115
const entries = new Map<number, ReactNode>();
1216
const listeners = new Set<Listener>();
1317

@@ -19,9 +23,7 @@ function emit() {
1923
}
2024

2125
export function OverlayPortal(props: { readonly children: ReactNode }) {
22-
const keyRef = useRef<number | null>(null);
23-
keyRef.current ??= nextKey++;
24-
const key = keyRef.current;
26+
const [key] = useState(allocateKey);
2527

2628
// No dependency array: re-project after every render so the host always
2729
// shows the current content (menus re-render while open — drill-in, theme).

0 commit comments

Comments
 (0)