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'

export default function Home () {
  const delayedMessage = new Promise((resolve) => {
    setTimeout(() => resolve('Hello from server!'), 2000)
  })
  return (
    <main>
      <div>
        <Component delayedMessage={delayedMessage}/>
      </div>
    </main>
  )
}
"use client"
export function Component ({
  delayedMessage
}) {
  return (
    <div>
      {delayedMessage}
    </div>
  )
}

The current behavior

image

The expected behavior

Won't have hydration error

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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