Switch from storing navigation state to checking for a draft observation #815
gmaclennan
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently we persist navigation state in the app, using what is considered an experimental feature in react navigation. The consequence of this is that if the app restarts, when the user next opens the app it will be on the same screen.
Our main motivation for doing this was to handle the case of an app crash / restart in the middle of the process of a user creating or editing an observation.
The state persistence adds technical overhead because we need to ensure that we throw out the saved navigation state if we release a new version of Mapeo with new screens or a different navigation structure. It might be desirable behaviour for some users, but there is also an advantage of returning to the home screen (the map screen) after a reset, since this can return the user to a familiar location if they have somehow reached a "dead end" in the app navigation (this could happen if the user opens a deep link to a screen that is not linked anywhere else).
I think a better solution would be to check for the existence of a draft observation when the app starts (it should be stored in the draft observation context) and if it exists, navigate to either the new observation screen or the edit observation screen. This would remove the need for the state persistence, but it does add the need for extra code for navigation based on the existence of the saved draft on app startup.
Beta Was this translation helpful? Give feedback.
All reactions