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

Fix routing #160

Merged
merged 1 commit into from
Jun 7, 2021
Merged

Fix routing #160

merged 1 commit into from
Jun 7, 2021

Conversation

malor
Copy link
Member

@malor malor commented Jun 6, 2021

#159 accidentally broke routing: apparently, React renders all matched routes by default, and so our new snippet id regexp does not play nicely with other routes like /about or /recent, which are now matched as well, because both "about" and "recent" are valid snippet ids.

The solution is to use the https://reactrouter.com/web/api/Switch component which renders the first matched Route as opposed to all of them.

#159 accidentally broke
routing: apparently, React renders *all* matched routes by default,
and so our new snippet id regexp does not play nicely with other
routes like /about or /recent, which are now matched as well, because
both "about" and "recent" are valid snippet ids.

The solution is to use the https://reactrouter.com/web/api/Switch
component which renders the *first* matched Route as opposed to all
of them.
@malor malor requested review from lotrien and ikalnytskyi June 6, 2021 19:35
@malor malor merged commit 0fe1894 into master Jun 7, 2021
@malor malor deleted the fix-routing branch June 7, 2021 18:34
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.

2 participants