Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: use location.state to store background route to prevent unmount #4062
fix: use location.state to store background route to prevent unmount #4062
Changes from 3 commits
c269825
5c0e4a3
de2e7c5
406fdd1
b05ef6b
b9f772b
364a7cd
2d5b02b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to declare
Routes
here so I can manipulate thelocation
depending on whetherbackgroundLocation
is populated or not.backgroundLocation
is the route above which the modal should appear.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it possible to also read location in app-routes to see if bg location is defined? Nw if not, just curious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can read the location there but the issue I struggled with is how to then feed said location into how we are creating the routes.
We are using
createHashRouter
andcreateRoutesFromElements
and I was unable to figure out how to pass thelocation
there.Eventually I came up with the idea of using
<Routes
nested in<Home
so I could then trick thelocation
.We can probably improve on that structure with more time and I am open to suggestions but I didn't want to start refactoring the whole of
app-routes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ActivityList
is loaded inhome.tsx
but the route needs to be declared here also.Similarly
settingsModalRoutes
needs to be passed in so you can use the settings modals from/activities