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

feat(next-app-router): listen to external URL changes #6107

Merged
merged 2 commits into from
Mar 27, 2024

Conversation

aymeric-giraudet
Copy link
Member

Fixes #6077

Summary

The App Router does not have events like the Pages router had, so we didn't implement a way to listen to external URL changes yet.

Result

The way to go is to use useEffect for that, as stated on their docs

I externalised everything into a hook to make the code easier to read and more focused, and to allow to do ISR / static generation more easily in the future (useSearchParams makes the page opt-out of such features)

@aymeric-giraudet aymeric-giraudet requested review from a team, sarahdayan and Haroenv and removed request for a team March 27, 2024 10:24
Copy link

codesandbox-ci bot commented Mar 27, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 6133c9d:

Sandbox Source
react-instantsearch-app Configuration
example-react-instantsearch-default-theme Configuration
example-react-instantsearch-next-app-dir-example Configuration
example-vue-instantsearch-default-theme Configuration

Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same remark about tests, but that makes sense for now still as it's "beta" and we have it as a remaining task to figure out how to test this

@aymeric-giraudet aymeric-giraudet merged commit 6f1f40b into master Mar 27, 2024
12 checks passed
@aymeric-giraudet aymeric-giraudet deleted the feat/next-app-router-listen-url branch March 27, 2024 14:19
@RobinGiel
Copy link

Is there a flag I can use to use this feature? because this push gave me issues with intercepted routes where the URL changes but no changes are needed from instant search. In the use case when the URL is used to just open a Modal for example no update is needed

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.

Filter is not working via URL when its on same page: Next.js App Routing
3 participants