couleurbummel
couleurbummel copied to clipboard
Selected item in the drawer defaults to wrong item
Is there an existing issue for this?
- [X] I have searched the existing issues
Happening on the latest app version?
- [X] I have seen this on the latest version of the app
This is not a data update request
- [X] I am not requesting a data update
Explain what you did
I restarted the app after previously navigating to a screen other than Map.
Describe the bug
The navigation drawer is highlighting the wrong screen. This is because we're persisting the state to storage: https://github.com/muffix/couleurbummel/blob/b0e7a2e425b6020e1fac4cb693960cc35daa8409/src/components/contexts/GlobalStateContext.tsx#L76-L79
When restarting the app, we are restoring the state for the navigation, but aren't respecting it for the content. We should do one of the following:
- remove the last selected screen from the persisted state and keep it only for as long as the app is running; meaning the app will always start on the Map screen
- restore the state fully and start on the last selected screen
Expected behaviour
The navigation drawer should highlight the correct item for the screen shown.
Steps to reproduce
1. Start the app
2. Navigate to any screen other than Map
3. Force-close the app
4. Reopen the app
5. Open the navigation drawer
6. Observe that the app starts on the Map screen, but the previously selected screen is highlighted in the navigation.
Your device and OS
Affects all devices, e.g. iPhone 12 Pro, iOS 16.2