Unverified Commit 460e19f0 authored by Balázs Orbán's avatar Balázs Orbán Committed by GitHub

docs(script): explain expected `next/script` behavior on client-side navigation (#42260)

This PR explains that a navigation via `Link` would not re-execute
`next/script` components once they are added.

Fixes #42111

Ref: [slack
thread](https://vercel.slack.com/archives/C02UJ0QH45Q/p1667237775929339)

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
parent 76fdd256
...@@ -90,6 +90,8 @@ Although the default behavior of `next/script` allows you load third-party scrip ...@@ -90,6 +90,8 @@ Although the default behavior of `next/script` allows you load third-party scrip
Refer to the [`next/script`](/docs/api-reference/next/script.md#strategy) API reference documentation to learn more about each strategy and their use cases. Refer to the [`next/script`](/docs/api-reference/next/script.md#strategy) API reference documentation to learn more about each strategy and their use cases.
> **Note**: Once a `next/script` component has been loaded by the browser, it will stay in the DOM and client-side navigations won't re-execute the script.
### Offloading Scripts To A Web Worker (experimental) ### Offloading Scripts To A Web Worker (experimental)
> **Note:** The `worker` strategy is not yet stable and does not yet work with the [`app/`](https://beta.nextjs.org/docs/routing/defining-routes) directory. Use with caution. > **Note:** The `worker` strategy is not yet stable and does not yet work with the [`app/`](https://beta.nextjs.org/docs/routing/defining-routes) directory. Use with caution.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment