Problem
When two devices with auto-timezone enabled are logged into the same account (or one is copiloting) and are in different timezones, an infinite loop of UpdateAutomaticTimezone API calls occurs, eventually bricking the request queue.
Root cause
The useAutoUpdateTimezone hook in src/hooks/useAutoUpdateTimezone.ts has a useEffect that depends on timezone?.selected. When Device A updates the timezone to its local value, Onyx pushes that change to Device B. Device B sees a mismatch between timezone.selected (now Device A's timezone) and its own local timezone, so it fires UpdateAutomaticTimezone with its timezone. This pushes back to Device A, and the cycle repeats infinitely.
Device A (TZ: America/New_York) → UpdateAutomaticTimezone(America/New_York)
→ Onyx push to Device B
Device B (TZ: Asia/Kolkata) → UpdateAutomaticTimezone(Asia/Kolkata)
→ Onyx push to Device A
... infinite loop
Impact
- The API request queue gets flooded with
UpdateAutomaticTimezone commands
- The app becomes unresponsive / bricked on both devices
- Staging environments can accumulate thousands of queued commands
Proposed solution
Two changes to src/hooks/useAutoUpdateTimezone.ts:
-
Skip auto-timezone for copilot/delegate sessions — A copilot should never change the primary user's timezone. Check account?.delegatedAccess?.delegate (using isActingAsDelegateSelector from src/selectors/Account.ts) and bail out early.
-
Throttle timezone updates to once per hour — For the same-user-on-multiple-devices case, add a module-level timestamp tracker. Only allow updateAutomaticTimezone to fire if at least 1 hour has elapsed since the last update on this device. This breaks the loop because after Device A updates, Device B's update attempt will be throttled, and vice versa.
Reproduction steps
- Log into the same account on two devices (or copilot into an account from a second device)
- Ensure both devices have "Set timezone automatically" enabled
- Set the two devices to different timezones
- Open the App on both devices
- Observe in the network tab that
UpdateAutomaticTimezone calls fire continuously in an infinite loop
Expected: Timezone updates should not loop between devices
Actual: Infinite loop of UpdateAutomaticTimezone API calls floods the request queue
Related code
src/hooks/useAutoUpdateTimezone.ts — the hook that triggers the update
src/libs/actions/PersonalDetails.ts — updateAutomaticTimezone() function
src/libs/Navigation/AppNavigator/AuthScreens.tsx — where the hook is called
src/selectors/Account.ts — isActingAsDelegateSelector for copilot detection
Issue Owner
Current Issue Owner: @shubham1206agra
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022027508067836219274
- Upwork Job ID: 2027508067836219274
- Last Price Increase: 2026-02-27
Problem
When two devices with auto-timezone enabled are logged into the same account (or one is copiloting) and are in different timezones, an infinite loop of
UpdateAutomaticTimezoneAPI calls occurs, eventually bricking the request queue.Root cause
The
useAutoUpdateTimezonehook insrc/hooks/useAutoUpdateTimezone.tshas auseEffectthat depends ontimezone?.selected. When Device A updates the timezone to its local value, Onyx pushes that change to Device B. Device B sees a mismatch betweentimezone.selected(now Device A's timezone) and its own local timezone, so it firesUpdateAutomaticTimezonewith its timezone. This pushes back to Device A, and the cycle repeats infinitely.Impact
UpdateAutomaticTimezonecommandsProposed solution
Two changes to
src/hooks/useAutoUpdateTimezone.ts:Skip auto-timezone for copilot/delegate sessions — A copilot should never change the primary user's timezone. Check
account?.delegatedAccess?.delegate(usingisActingAsDelegateSelectorfromsrc/selectors/Account.ts) and bail out early.Throttle timezone updates to once per hour — For the same-user-on-multiple-devices case, add a module-level timestamp tracker. Only allow
updateAutomaticTimezoneto fire if at least 1 hour has elapsed since the last update on this device. This breaks the loop because after Device A updates, Device B's update attempt will be throttled, and vice versa.Reproduction steps
UpdateAutomaticTimezonecalls fire continuously in an infinite loopExpected: Timezone updates should not loop between devices
Actual: Infinite loop of
UpdateAutomaticTimezoneAPI calls floods the request queueRelated code
src/hooks/useAutoUpdateTimezone.ts— the hook that triggers the updatesrc/libs/actions/PersonalDetails.ts—updateAutomaticTimezone()functionsrc/libs/Navigation/AppNavigator/AuthScreens.tsx— where the hook is calledsrc/selectors/Account.ts—isActingAsDelegateSelectorfor copilot detectionIssue Owner
Current Issue Owner: @shubham1206agraUpwork Automation - Do Not Edit