Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Component returning string causes hydration mismatch #24567

Closed
subhero24 opened this issue May 18, 2022 · 4 comments
Closed

Bug: Component returning string causes hydration mismatch #24567

subhero24 opened this issue May 18, 2022 · 4 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@subhero24
Copy link

I have a component like this:

function Component() {
    let string = useSuspendingHook()

    return string
}

On the server I render the component with renderToPipeableStream. When hydrating the component I get a Hydration failed because the initial UI does not match what was rendered on the server..

What makes me think this is a bug in react and not my code, is that everything works when I wrap the returned string in a <div> like so:

function Component() {
    let string = useSuspendingHook()

    return <div>{string}</div>
}

Also, would it be possible to have some extra info on the error what the mismatch in hydration actually is?

@subhero24 subhero24 added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label May 18, 2022
@InfinytRam
Copy link

possibly related to this hydration issue? #24578

@gaearon
Copy link
Collaborator

gaearon commented May 20, 2022

Can you please create a minimal reproducing case? Thanks.

@gaearon
Copy link
Collaborator

gaearon commented May 25, 2022

Just a reminder we'll need a reproducing case. Otherwise I'll close this.

@subhero24
Copy link
Author

I failed to create a minimal reproducing case where the problem also happens. Have no idea what makes the situation different with the full application. Will close for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

3 participants