Next.js Discord

Discord Forum

Hydration error that seems to be out of my control, any ideas?

Answered
Giant ichneumon wasp posted this in #help-forum
Open in Discord
Giant ichneumon waspOP
There's no variable data, no runtime randomness, just pure confusion. Trying out the next and react 19 rc with compiler
definition:
'use client';

export default function Typewriter({ text }) {
    return (
        <>
            <span className="whitespace-pre-line">{text.substring(0, 0)}</span>
            <span className="whitespace-pre-line text-transparent">{text.substring(0)}</span>
        </>
    );
}
call site (also a client component):
<Typewriter text={'Hi.\nWelcome to my portfolio.'} />
Answered by Giant ichneumon wasp
Confirmed this is a compiler bug, filed https://github.com/facebook/react/issues/29648
View full answer

8 Replies

Giant ichneumon waspOP
Not sure if this is even a next problem, but since it's SSR, it feels more appropriate to mention it here than with React themselves
maybe <span> can not contain another <span>i misread your uploads mb
Giant ichneumon waspOP
Actually this might be a react-compiler problem, though certainly a confusing one
gonna keep this open for posterity and open an issue there
(note that this still might be nextjs, since SSR, but I do sincerely have no idea)
Giant ichneumon waspOP
Confirmed this is a compiler bug, filed https://github.com/facebook/react/issues/29648
Answer
Giant ichneumon waspOP
I'll note that the reason it was a hydration error is that the server bundle for next doesn't use the compiler even when enabled
not that it would make sense to, of course