From 2e185a7c4f44c6867722b6aa0bcaadce881697ee Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Fri, 29 May 2026 19:13:19 -0700 Subject: [PATCH] Move mobile tasks client ref sync out of effect (#3253) * Move mobile tasks client ref sync out of effect * Use layout effect for mobile tasks client ref Co-authored-by: Orca --------- Co-authored-by: Jinwoo-H Co-authored-by: Orca --- mobile/app/h/[hostId]/tasks.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mobile/app/h/[hostId]/tasks.tsx b/mobile/app/h/[hostId]/tasks.tsx index 7785435a401..d62cc31b914 100644 --- a/mobile/app/h/[hostId]/tasks.tsx +++ b/mobile/app/h/[hostId]/tasks.tsx @@ -1,4 +1,4 @@ -import { useCallback, useEffect, useMemo, useRef, useState } from 'react' +import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react' import type { ReactNode } from 'react' import { ActivityIndicator, @@ -2534,7 +2534,9 @@ export default function MobileTasksScreen() { return [...logins].sort().join(',') }, [projectRowDetail, projectRowItem?.content.assignees]) - useEffect(() => { + // Why: task-loading effects use this as a stale-client guard, so the ref + // must be current before those passive effects can run after commit. + useLayoutEffect(() => { clientRef.current = client }, [client])