Fix router matching utility in case matching with "startsWith" and searched part is inside of current url #16245
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.
Issue: If the title of a story contains a word
settings
(i.e.Settings/Inner page/Inner component
), resulted story page will have Controls tab all white and unclickable.The reason it is overlapped with scrollbar components containers from the /settings route
storybook/lib/ui/src/app.tsx
Line 51 in ce10c0d
The root cause
@storybook/router
's functiongetMatch
storybook/lib/router/src/utils.ts
Line 148 in d768373
The bug is inside condition - instead of failing fast if
startsWith
is set, we are going further and return onmatchTarget
storybook/lib/router/src/utils.ts
Line 154 in d768373
What I did
Fix is applied to
getMatch
functionHow to test
Tests are added to
@storybook/router
To reproduce case visually, create a story with name contains
Settings/
(i.e.Settings/Page/Component
) and try to render it with essentials addon enabled