Skip to content

Bug: pending attribute from useFormStatus is stuck as "true" when form action takes longer than ~5s to resolve #27630

@Veath

Description

@Veath

React version: canary

Steps To Reproduce

  1. open example link-This is a demo example from the official website, only the settimeout time has been changed.(form action resolve promise after 10 seconds)
  2. click submit button
  3. see the button text

Link to code example: https://codesandbox.io/s/useformstatus-vzn8tm?file=/App.js:129-142

The current behavior

The button triggers the form action, and the pending useFormStatus is always true, even if the action is completed.

The expected behavior

The button triggers the form action. After the action is executed, useFormStatus should change from pending-true to pending-false.

Debug found that when the code is executed here-renderRootSync, throwValue has actually been resolved. If throwAndUnwindWorkLoop adds a then callback after resolved, it will not be triggered.
image

If you change the settimeout timer in the form action to a smaller value, such as 1000ms, then the code will go here renderRootConcurrent, and replaySuspendedUnitOfWork can start to re-render.
image

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions