Skip to content

Commit 3e04518

Browse files
docs
1 parent 2be2594 commit 3e04518

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

documentation/docs/06-runtime/05-hydratable.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,19 @@ All data returned from a `hydratable` function must be serializable. But this do
6363
{await promises.one}
6464
{await promises.two}
6565
```
66+
67+
## CSP
68+
69+
`hydratable` adds an inline `<script>` block to the `head` returned from `render`. If you're using CSP, this script will likely fail to run. You can provide a `nonce` to `render`:
70+
71+
```ts
72+
const { head, body } = await render(App, { csp: { nonce: 'abcd123' } });
73+
```
74+
75+
This will add the `nonce` to the script block. If you need to use hashes instead, you can do that as well:
76+
77+
```ts
78+
const { head, body, hashes } = await render(App, { csp: { hash: true } });
79+
```
80+
81+
`hashes.style` will be `["sha256-abcd123"]`. We recommend using `nonce` over hash if you can, as `hash` will interfere with streaming SSR in the future.

0 commit comments

Comments
 (0)