Skip to content

Bug: putting promise into JSX will cause hydration issue #27778

Description

@himself65

React version: 18.3.0-canary-5dd35968b-20231201

Steps To Reproduce

  1. clone https://github.com/himself65/react-hydration-error
  2. pnpm install && pnpm run dev

Link to code example:

import{Component}from'@/components/component'exportdefaultfunctionHome(){constdelayedMessage=newPromise((resolve)=>{setTimeout(()=>resolve('Hello from server!'),2000)})return(<main><div><ComponentdelayedMessage={delayedMessage}/></div></main>)}
"use client"exportfunctionComponent({
delayedMessage
}){return(<div>{delayedMessage}</div>)}

The current behavior

image

The expected behavior

Won't have hydration error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: StaleAutomatically closed due to inactivityStatus: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions