Skip to content

Bug: event.preventDefault is wrecking havoc with startTransition #18020

Closed
@arackaf

Description

@arackaf

React version: 241c446

Steps To Reproduce

https://codesandbox.io/s/romantic-gates-2hrjp

  1. Click "Show A" to render the lazy component.
  2. Type into the input whose placeholder says it works. startTransition will call, inline loading will show for 2 seconds, then the Suspense boundary will trigger.
  3. Click the "update" button - same as above - everything works
  4. Now type into the input whose placeholder says it doesn't work. Note that the inline placeholder stays up for the entire time; the Suspense boundary never shows.
  5. Now note that steps 2 or 3 will likely immediately show the suspense boundary. The bypassed rendering of the Suspense boundary from step 4 seems to be backed up, stuck somewhere, and is now unleashed.

Note that steps 2 and 3 are optional. No matter what, the preventDefault that's called in step 4 causes this incorrect behavior no matter whether steps 2 or 3 have been exercised.

Link to code example: see above

The current behavior

startTransition should suspend after the timeout even if event.preventDefault is called.

The expected behavior

it does not

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions