Skip to content

Commit

Permalink
docs(script): explain expected next/script behavior on client-side …
Browse files Browse the repository at this point in the history
…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: JJ Kasper <jj@jjsweb.site>
  • Loading branch information
balazsorban44 and ijjk committed Nov 2, 2022
1 parent 76fdd25 commit 460e19f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/basic-features/script.md
Expand Up @@ -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.

> **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)

> **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.
Expand Down

0 comments on commit 460e19f

Please sign in to comment.