Skip to content
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

Draft
wants to merge 13 commits into
base: WEB-3397-mobile-views
Choose a base branch
from

Conversation

henry-tp
Copy link
Contributor

@henry-tp henry-tp commented Jan 16, 2025

@henry-tp henry-tp changed the title [WEB-3352] - TIDE Drawer Navigation Bug [WEB-3352] - TIDE Drawer Navigation Bugs Jan 16, 2025
@henry-tp henry-tp marked this pull request as ready for review January 16, 2025 20:10
const params = new URLSearchParams(search);
params.delete('drawerPatientId');
history.replace({ pathname, search: params.toString() });
}
Copy link
Contributor Author

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.

@henry-tp henry-tp marked this pull request as draft January 17, 2025 22:11
@henry-tp henry-tp marked this pull request as ready for review January 19, 2025 23:53
}) => {
const history = useHistory();
const { search } = useLocation();
const [initialSearchParams] = useState(new URLSearchParams(search));
Copy link
Contributor Author

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

Screen.Recording.2025-01-21.at.11.08.10.mov

@henry-tp henry-tp marked this pull request as draft January 30, 2025 15:39
@henry-tp henry-tp changed the base branch from develop to WEB-3397-mobile-views January 31, 2025 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant