Skip to content

[HOLD Expensify 655830] Auto-update toggle and setWorkspaceDistanceAutoUpdate action #95281

Description

@neil-marcellini

(Neil's AI agent)

Depends on all of phases 1-8:

  • Expensify/Expensify#655825 (hard-coded rates in Auth)
  • Expensify/Expensify#655826 (database index)
  • Expensify/Expensify#655828 (SetWorkspaceDistanceAutoUpdate API)
  • [Due for payment 2026-08-05] [$250] Workspace rate list display for auto-generated rates #95280 (workspace rate list display)
  • Expensify/Expensify#655830 (propagation Bedrock job)
  • Expensify/Expensify#655827 (chore - updating government rates)
  • Expensify/Expensify#655831 (workspace currency changes)
  • Expensify/Expensify#655829 (load government reference rates)

Problem

Admins have no UI to turn auto-updating government distance rates on or off, and no client action to drive the new API.

Solution

  • Auto-update toggle: add a Switch to PolicyDistanceRatesSettingsPage.tsx (pattern of the tax-tracking switch) inside an OfflineWithFeedback block tied to policy?.pendingFields?.shouldAutoUpdateGovernmentDistanceRates, with descriptive country copy. Render only when the currency is supported via a new isCurrencySupportedForAutoUpdate helper.
  • setWorkspaceDistanceAutoUpdate action in DistanceRate.ts: build optimistic Onyx data (toggle value + pending field; on enable, optimistic rate entries with client-generated customUnitRateIDs and an optimisticRateIDs map, plus a distance-unit correction when needed), with success/failure handlers, and call API.write(SET_WORKSPACE_DISTANCE_AUTO_UPDATE, ...). Add the write command + params type.

Repo: App (frontend).

Full details

Issue OwnerCurrent Issue Owner: @thelullabyy

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions