Skip to content

Commit 19e1a53

Browse files
committed
fix(mobile): keep the connectionRemoved handler ref out of render
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTVYu9vDSx28X2zi7h
1 parent 08aaae5 commit 19e1a53

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎ui/packages/mobile/src/useNativeHost.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ export function useNativeHostRouting({
132132
// The latest handler, read when the event fires, so the listener does not
133133
// re-install on every render that passes a new function.
134134
const onConnectionRemovedRef = useRef(onConnectionRemoved);
135-
onConnectionRemovedRef.current = onConnectionRemoved;
135+
useEffect(() => {
136+
onConnectionRemovedRef.current = onConnectionRemoved;
137+
}, [onConnectionRemoved]);
136138

137139
useEffect(() => {
138140
if (host) postNativeReady(host);

0 commit comments

Comments
 (0)