Skip to content

[$250] Infinite UpdateAutomaticTimezone loop when two devices are in different timezones #83765

@mountiny

Description

@mountiny

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:

  1. 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.

  2. 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

  1. Log into the same account on two devices (or copilot into an account from a second device)
  2. Ensure both devices have "Set timezone automatically" enabled
  3. Set the two devices to different timezones
  4. Open the App on both devices
  5. 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.tsupdateAutomaticTimezone() function
  • src/libs/Navigation/AppNavigator/AuthScreens.tsx — where the hook is called
  • src/selectors/Account.tsisActingAsDelegateSelector for copilot detection
Issue OwnerCurrent 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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorMonthlyKSv2ReviewingHas a PR in review

Type

No type
No fields configured for issues without a type.

Projects

Status

LOW

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions