-
Notifications
You must be signed in to change notification settings - Fork 205
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(dev-portal): fix broken hash router links #2497
Conversation
✅ Deploy Preview for stoplight-elements ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for stoplight-elements-demo ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Looks good to me. Had one tiny question/suggestion. Feel free to take it or leave it.
return ( | ||
<Box | ||
as={LinkComponent} | ||
to={makeSlugAbsoluteRoute && !/^\//.test(item.slug) ? `/${item.slug}` : item.slug} |
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.
It took me a minute to find this change, so I'm just marking it for other reviewers.
Is there an advantage to using a regular expression here instead of !item.slug.startsWith('/')
?
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.
old habits die hard
cedb6b6
to
438a6f2
Compare
438a6f2
to
3615963
Compare
when using elements-dev-portal and the hash router, a custom toc with slugs would result in a broken page. this fixes the route matching and makes the routes absolute