Page MenuHomePhabricator

[native] fix assumption that in `ThreadScreenPruner` app route is defined
ClosedPublic

Authored by kamil on Dec 8 2022, 6:33 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 15, 9:00 PM
Unknown Object (File)
Sun, Dec 15, 9:00 PM
Unknown Object (File)
Sun, Dec 15, 9:00 PM
Unknown Object (File)
Sun, Dec 15, 8:59 PM
Unknown Object (File)
Sun, Dec 15, 8:51 PM
Unknown Object (File)
Nov 7 2024, 5:48 AM
Unknown Object (File)
Nov 7 2024, 5:48 AM
Unknown Object (File)
Nov 6 2024, 6:23 AM
Subscribers

Details

Summary

Problem described in ENG-2427.
Probably we want to investigate deeper, maybe there is no need for invariant in other usages of getStateFromNavigatorRoute - if yes I can create an issue.

Test Plan

Invariant should not crash app in dev mode while ThreadScreenPruner is rendered but NavState wasn't fully propagated, e.g. because App Navigator isn't the top of the stack

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kamil held this revision as a draft.
kamil published this revision for review.Dec 8 2022, 6:48 AM
inka added 1 blocking reviewer(s): tomek.

I think PossiblyStaleRoute is not typed correctly... based on the Linear comment I seem to remember @kamil making, I think it was possible for state to not be set in some circumstances where our types think it must be set. We should fix this

This diff is still a good idea, but it should be forced by Flow types. Let's follow-up on that

tomek added inline comments.
native/chat/thread-screen-pruner.react.js
54–57 ↗(On Diff #19253)

This seems to be more or less equivalent to

This revision is now accepted and ready to land.Dec 9 2022, 9:50 AM

rebase

native/chat/thread-screen-pruner.react.js
54–57 ↗(On Diff #19253)

Definitely, but looks like flow has a different opinion than we do 😄

Cannot get chatRoute?.state because property state is missing in StaleLeafRoute [1]. [prop-missing]