Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lazy-lions-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@uploadthing/react": patch
---

feat: optional `nonce` prop for `NextSSRPlugin`
11 changes: 9 additions & 2 deletions packages/react/src/next-ssr-plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ declare const globalThis: {
__UPLOADTHING?: EndpointMetadata;
};

export function NextSSRPlugin(props: { routerConfig: EndpointMetadata }) {
export function NextSSRPlugin(props: {
routerConfig: EndpointMetadata;
nonce?: string;
}) {
const id = useId();

// Set routerConfig on server globalThis
Expand All @@ -22,7 +25,11 @@ export function NextSSRPlugin(props: { routerConfig: EndpointMetadata }) {
];

return (
<script key={id} dangerouslySetInnerHTML={{ __html: html.join("") }} />
<script
key={id}
nonce={props.nonce}
dangerouslySetInnerHTML={{ __html: html.join("") }}
/>
);
});

Expand Down
Loading