Replies: 4 comments 6 replies
-
Hi @curler7, I can't reproduce this on the deployed version of the stack: https://www.epicstack.dev |
Beta Was this translation helpful? Give feedback.
-
Adding my $0.02 to the discussion. When I run Firefox Developer Edition and these initial commands: npx create-epic-app@latest
# didn't setup deploy. picked random name.
cd <randomly_picked_name>
npm run dev Upon opening the app I received the following screenshot: (validated while Private Browsing) Checked in private browsing as recommended by @kiliman and still receiving this. To add further note, I am not seeing the same thing in Chrome DevTools locally. Surprisingly enough even though the ![]()
I assume this is the proper solution is just await React 19? ☝️ Let me know and thanks for reading! |
Beta Was this translation helpful? Give feedback.
-
Hi, the // entry.server.tsx
export default async function handleRequest(...args: DocRequestArgs) {
//...
const nonce = crypto.randomBytes(16).toString('hex')
return new Promise(async (resolve, reject) => {
//...
const { pipe, abort } = renderToPipeableStream(
<NonceProvider value={nonce}>
<ServerRouter
nonce={nonce}
context={reactRouterContext}
url={request.url}
/>
</NonceProvider>,
{
//...
nonce
}
)
setTimeout(abort, streamTimeout + 5000)
})
} but not client Side // entry.client.tsx
startTransition(() => {
hydrateRoot(document, <HydratedRouter />)
}) // root.tsx
export function Layout({ children }: { children: React.ReactNode }) {
// if there was an error running the loader, data could be missing
const data = useLoaderData<typeof loader | null>()
const nonce = useNonce()
// correct value server side
// default value of NonceContext client side -> empty string
} to highlight the issue. // nonce-provider.ts
export const NonceContext = React.createContext<string>('hello'); we have a hydration error on all browsers with Firefox <script
+ nonce="hello" // default value client side
- nonce="edd3ae271e08d972ebd0d3440a1b1909" // server side
dangerouslySetInnerHTML={{__html:"\n// This ..."}}
> with Chrome based <script
+ nonce="hello" // default value client side
- nonce="" // not accessible ?? but present in the source code
dangerouslySetInnerHTML={{__html:"\n// This ..."}}
> What do you think? |
Beta Was this translation helpful? Give feedback.
-
I'm stupid, the goal being precisely not to be able to access it on the client side... However, I have an answer about Firefox's behavior. If you set |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Getting following error on browser console
Warning: Prop
nonce
did not match. Server: "0d1781b142423cac737af4b3e38a32ea" Client: ""Getting started with the following instructions
git clone https://github.com/epicweb-dev/epic-stack.git
cd epic-stack
npm install
cp .env.example .env
npm run setup
Tested with firefox and chromium. Both displayed same error.
Did i missed something? Thx for response.
Beta Was this translation helpful? Give feedback.
All reactions