urql-graphql / urql

The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
https://urql.dev/goto/docs
MIT License
8.57k stars 444 forks source link

feat(next): nonce support #3398

Closed Enalmada closed 9 months ago

Enalmada commented 10 months ago

Summary

Next.js 13.5 has put in some work into achieving a strict CSP through documentation, example, and code.

When trying it out, I discovered the next urql provider doesn't pass through a nonce. This PR adds a optional nonce parameter to the provider:

    <UrqlProvider client={client} ssr={ssr} nonce={nonce} >
      {children}
    </UrqlProvider>

When passed, the script will render with it:

<script nonce="NjJiMGYxNDUtZTRjMS00ODYwLWI3ZTUtYmZmMDVkMzY1YTUw">(window[Symbol.for("urql_transport")] ??= []).push({"rehydrate":{"-8349710366": ... />

Set of changes

Not changed

changeset-bot[bot] commented 10 months ago

🦋 Changeset detected

Latest commit: 84f4ff4b89dfdc45f616c4628c42fc897a93c9c6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ---------- | ----- | | @urql/next | Minor |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR