Navigates to sync, but then app "resets" and you end up on Map screen
Think i have a decent idea of the issue(s). First, after accepting an invite, we have a hardcoded setTimeout of 5 seconds before updating the active project id state:
this aligns with what i see where i could update the code to navigate to some other screen (instead of sync) and the same behavior would be observed.
i think the bigger issue is that calling switchActiveProject(projectId); basically resets/remounts the navigation, which means that things like the initialRouteName are re-calculated and applied. I think the remounting happens because we're wrapping our navigations with suspense, and many of the suspense queries are dependent on that active project id state that we're updating (which seems reasonable).
Not sure what the proper way of fixing is, but hoping that I'm identifying the problem correctly to begin with 🤔
Discovered via https://github.com/digidem/comapeo-mobile/pull/405. As an example, the invite flow for someone joining a project has the following unexpected UX:
Think i have a decent idea of the issue(s). First, after accepting an invite, we have a hardcoded
setTimeout
of 5 seconds before updating the active project id state:https://github.com/digidem/comapeo-mobile/blob/c09460f425a5e21f1a3db456a14735c2a59d9476/src/frontend/hooks/server/invites.ts#L38-L51
this aligns with what i see where i could update the code to navigate to some other screen (instead of sync) and the same behavior would be observed.
i think the bigger issue is that calling
switchActiveProject(projectId);
basically resets/remounts the navigation, which means that things like theinitialRouteName
are re-calculated and applied. I think the remounting happens because we're wrapping our navigations with suspense, and many of the suspense queries are dependent on that active project id state that we're updating (which seems reasonable).Not sure what the proper way of fixing is, but hoping that I'm identifying the problem correctly to begin with 🤔