-
Notifications
You must be signed in to change notification settings - Fork 1
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
Persist search string when navigating internal links #2058
Persist search string when navigating internal links #2058
Conversation
d62fdf6
to
080be30
Compare
080be30
to
d72e777
Compare
d72e777
to
f58ed3e
Compare
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.
Since there's already a test file, it may be nice to add a test to show what changed.
|
||
const options = createNavigationOptions(systemQueryParams as SystemQueryParams); |
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.
These lines the linter is breaking down are really not that long...
const additionalQueryString = new URLSearchParams( | ||
persistentQueryParams as Record<string, string> | ||
).toString(); | ||
const extendedSearchString = (search + '&' + additionalQueryString).substring( |
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.
You might have to do something when additionalQueryString
is empty so there's not a &
at the end?
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.
queryString.parse cleans this up. But that gives me an idea for a tidier solution.
@@ -152,6 +152,7 @@ describe('contentLinkHandler', () => { | |||
|
|||
it('intercepts clicking content links with slug', async() => { | |||
const link = `/books/${book.slug}/pages/page-title`; | |||
prop.currentPath = '/asdf?foo=bar'; |
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.
Is this unrelated? This seems to be the only instance in the PR of something changing that has to do with currentPath.
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 modified the test so that I could have one with a pre-existiing search string.
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 further modified the test to check the search string result.
f1a8b91
to
a2b2ec5
Compare
e2b0ad9
to
9b49c00
Compare
9b49c00
to
2772916
Compare
For: https://github.com/openstax/unified/issues/2244