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

Persist search string when navigating internal links #2058

Merged

Conversation

RoyEJohnson
Copy link
Contributor

@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-hmhxld October 18, 2023 22:13 Inactive
@RoyEJohnson RoyEJohnson force-pushed the include-persistent-query-params-in-links-within-books branch from d62fdf6 to 080be30 Compare October 18, 2023 22:16
@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-hmhxld October 18, 2023 22:16 Inactive
@RoyEJohnson RoyEJohnson force-pushed the include-persistent-query-params-in-links-within-books branch from 080be30 to d72e777 Compare October 18, 2023 22:33
@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-hmhxld October 18, 2023 22:33 Inactive
@RoyEJohnson RoyEJohnson force-pushed the include-persistent-query-params-in-links-within-books branch from d72e777 to f58ed3e Compare October 18, 2023 23:05
@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-hmhxld October 18, 2023 23:06 Inactive
@RoyEJohnson RoyEJohnson marked this pull request as ready for review October 18, 2023 23:43
@RoyEJohnson RoyEJohnson requested a review from a team as a code owner October 18, 2023 23:43
@RoyEJohnson RoyEJohnson requested a review from Dantemss October 18, 2023 23:43
Copy link
Member

@Dantemss Dantemss left a 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);
Copy link
Member

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(
Copy link
Member

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?

Copy link
Contributor Author

@RoyEJohnson RoyEJohnson Oct 19, 2023

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';
Copy link
Member

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.

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 modified the test so that I could have one with a pre-existiing search string.

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 further modified the test to check the search string result.

@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-hmhxld October 19, 2023 20:24 Inactive
@RoyEJohnson RoyEJohnson force-pushed the include-persistent-query-params-in-links-within-books branch from f1a8b91 to a2b2ec5 Compare October 19, 2023 21:06
@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-hmhxld October 19, 2023 21:07 Inactive
@RoyEJohnson RoyEJohnson requested a review from Dantemss October 19, 2023 21:51
@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-hmhxld October 24, 2023 05:01 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-hmhxld October 24, 2023 05:21 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-hmhxld October 24, 2023 05:35 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-hmhxld October 24, 2023 13:39 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-hmhxld October 24, 2023 14:06 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-hmhxld October 24, 2023 15:33 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-hmhxld October 24, 2023 19:25 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-hmhxld October 25, 2023 18:06 Inactive
@RoyEJohnson RoyEJohnson force-pushed the include-persistent-query-params-in-links-within-books branch from e2b0ad9 to 9b49c00 Compare January 10, 2024 19:03
@RoyEJohnson RoyEJohnson force-pushed the include-persistent-query-params-in-links-within-books branch from 9b49c00 to 2772916 Compare January 10, 2024 20:32
@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-lmr7pd January 12, 2024 21:18 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-lmr7pd January 12, 2024 21:19 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-lmr7pd January 12, 2024 21:19 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-lmr7pd January 12, 2024 21:20 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-lmr7pd January 12, 2024 21:20 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-lmr7pd January 16, 2024 12:15 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-include-persist-lmr7pd January 16, 2024 13:17 Inactive
@Malar-Natarajan Malar-Natarajan merged commit 1c2ac9a into main Jan 24, 2024
10 of 11 checks passed
@Malar-Natarajan Malar-Natarajan deleted the include-persistent-query-params-in-links-within-books branch January 24, 2024 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants