-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
[WEB-3352] - TIDE Drawer Navigation Bugs #1500
base: WEB-3397-mobile-views
Are you sure you want to change the base?
Conversation
const params = new URLSearchParams(search); | ||
params.delete('drawerPatientId'); | ||
history.replace({ pathname, search: params.toString() }); | ||
} |
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 really am not a fan of doing this kind of thing in side effects like this. I worked on a few of different solutions and this ended up being the best of the evils.
The main challenge is the question of how to make the drawer initialize in an open or closed state but without requiring the originating page to have contextual knowledge about the TIDE dashboard.
}) => { | ||
const history = useHistory(); | ||
const { search } = useLocation(); | ||
const [initialSearchParams] = useState(new URLSearchParams(search)); |
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.
By storing in state here, I am just caching the value url searchParams
at the first render, so that if the route changes, the back button has a reference to what the search params were on component mount
WEB-3352