mirror of
https://github.com/stablyai/orca.git
synced 2026-10-15 08:03:08 +00:00
perf: move mobile source control cleanup to root ref
This commit is contained in:
@@ -288,12 +288,16 @@ export default function MobileSourceControlScreen() {
|
||||
currentStatusIdentityRef.current = statusIdentityKey
|
||||
currentBranchCompareIdentityRef.current = statusIdentityKey
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
mountedRef.current = false
|
||||
loadGenerationRef.current += 1
|
||||
branchCompareGenerationRef.current += 1
|
||||
const setMobileSourceControlRootRef = useCallback((node: View | null): void => {
|
||||
if (node !== null) {
|
||||
mountedRef.current = true
|
||||
return
|
||||
}
|
||||
// Why: source-control RPC loads can outlive the route; invalidate pending
|
||||
// writes when the screen detaches without a passive cleanup-only Effect.
|
||||
mountedRef.current = false
|
||||
loadGenerationRef.current += 1
|
||||
branchCompareGenerationRef.current += 1
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
@@ -1336,7 +1340,7 @@ export default function MobileSourceControlScreen() {
|
||||
}, [branchDiffPreview])
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<View ref={setMobileSourceControlRootRef} style={styles.container}>
|
||||
<SafeAreaView style={styles.header} edges={['top']}>
|
||||
<View style={styles.topBar}>
|
||||
<Pressable
|
||||
|
||||
Reference in New Issue
Block a user