perf: pre-warm user location in ShareRootPage and read via Onyx.get

Open
#106,043 0 comments 0 reactions 3 assignees View on GitHub

Maintainers usually reply within 1 day

@truph01 is already working on this.

Since Nov 4, 2026.

Assessment

This issue has not been assessed yet.

Description

Daily Task

Problem

SubmitDetailsPage called snapshotUserLocation() on mount and held a reactive useOnyx(ONYXKEYS.USER_LOCATION) subscription. Querying device GPS permissions and writing coordinates into Onyx inside the ShareExtensionOpenSubmitFlow span caused main thread latency and extra re-renders, even though the coordinates are only needed at submit time.

Solution

Pre-warm the location in ShareRootPage when a scannable receipt is processed, so the GPS read happens outside the span. SubmitDetailsPage now reads the cache once with Onyx.get at submit time and falls back to a capped device read when nothing is cached. snapshotUserLocation() also clears USER_LOCATION before the permission check, so a stale value is never attached as gpsPoint.

PR

https://github.com/Expensify/App/pull/104479

Issue OwnerCurrent Issue Owner: @truph01
Dominant language
TypeScript
Stars
5k
Forks
4k
Avg merge
3d 7h
Merged PRs (30d)
561

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Expensify/App

All issues in Expensify/App

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.