Make getNewScreenTimeToDisplay race-free by moving it to the native store/pull model
Mantenedores costumam responder em até 1 dia
@antonis já está trabalhando nisso.
Desde 14/9/2026.
Avaliação
Esta issue ainda não foi avaliada.
Descrição
Background
#6722 fixes the fatal JavaCallback was already settled crash from getNewScreenTimeToDisplay under rapid navigation on Android (#6709). That fix makes losing the race survivable (crash → dropped measurement) but does not close the race window itself.
Why the window is intrinsic to the current design
RNSentryTimeToDisplay.getTimeToDisplay schedules a deferred Choreographer frame callback that resolves a live Promise after the frame renders. The producer (native frame callback) and consumer (JS promise / backing JavaCallback) have independent lifetimes:
- Native gets no teardown signal when a navigation is superseded, so it can't cancel the pending frame callback.
com.facebook.react.bridge.Promiseexposes no validity query, and even a check would be TOCTOU.- The deferred settle is the measurement (time to first frame after navigation), so we can't resolve early to dodge the race.
The only atomic option at that layer is attempt-and-catch — which is what #6722 does.
Proposed race-free design
Move getNewScreenTimeToDisplay to the store/pull model that the other TTID paths already use: the frame callback writes the timestamp into the native screenIdToRenderDuration map (via putTimeToDisplayFor), and JS pops it later via popTimeToDisplayFor — same pattern as ttid-, ttfd-, and ttid-navigation- (see timeToDisplayIntegration.ts). A stored value has no long-lived bridge callback, so there is no "already settled" failure mode at all.
Scope / considerations
- Bridge spec change (
NativeRNSentry.ts) → breaking, needs a@deprecatedmigration path. - Must be implemented on both platforms (Android + iOS — the iOS variant of the settle-after-teardown risk was deferred in #6722).
- Changes the fallback contract in
sentryeventemitterfallback.ts, which currently races the native promise againstrequestAnimationFrame; a pull model changes that timing and needs care.
Acceptance criteria
-
getNewScreenTimeToDisplay's deferred measurement no longer relies on resolving a long-lived promise from a frame callback. - No behavioral regression in TTID measurements on either architecture (New + Old) or platform (iOS + Android).
- Deprecation path for the bridge API change.
- Linguagem predominante
- TypeScript
- Estrelas
- 1.8k
- Forks
- 371
- Merge médio
- 1d 6h
- PRs com merge (30d)
- 114
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de getsentry/sentry-react-native
-
React-Native Replays Task
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
getsentry/sentry-react-native#6680 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Improvement React-Native
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
getsentry/sentry-react-native#6143 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
React-Native Task User Feedbacks
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
getsentry/sentry-react-native#5932 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
React-Native Replays Task
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
getsentry/sentry-react-native#5882 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Good First Issue React-Native Task
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 65/100
getsentry/sentry-react-native#5771 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de getsentry/sentry-react-native
Issues semelhantes
-
mobile-app
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
Open-Locker/Open-Locker#352 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
leanprover-community/lean4game#589 ·
Mantenedores costumam responder em até 2 dias
-
Add: CS Action BGAbertacheck:passed streams:add
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 68/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 82/100
unocss/unocss#5421 · 1 comentário ·
Mantenedores costumam responder em até 1 dia