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

fix(next-app-router): do not retrieve headers in csr #6228

Merged
merged 3 commits into from
Jun 5, 2024

Conversation

dhayab
Copy link
Member

@dhayab dhayab commented Jun 5, 2024

Summary

This PR fixes a side-effect introduced in #6223 , which tries to retrieve a nonce value from headers to apply it to the injected script tag. It unconditionally called Next's headers() in SSR and CSR, which caused the implementation to throw an error at the first CSR search interaction, because headers() are obviously not retrievable from a client environment.

The header() function is now only called in SSR.

@dhayab dhayab requested review from a team, sarahdayan, aymeric-giraudet and Haroenv and removed request for a team and sarahdayan June 5, 2024 12:08
Copy link

codesandbox-ci bot commented Jun 5, 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 c26e747:

Sandbox Source
example-instantsearch-getting-started Configuration
example-react-instantsearch-getting-started Configuration
example-react-instantsearch-next-app-dir-example Configuration
example-react-instantsearch-next-routing-example Configuration
example-vue-instantsearch-getting-started Configuration

@algolia algolia deleted a comment from codesandbox-ci bot Jun 5, 2024
@algolia algolia deleted a comment from codesandbox-ci bot Jun 5, 2024
@dhayab dhayab merged commit 4fca256 into master Jun 5, 2024
11 of 12 checks passed
@dhayab dhayab deleted the fix/next-nonce-csr branch June 5, 2024 14:13
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.

None yet

2 participants