Skip to content

Suspense issues #15471

Closed
Closed
@bvaughn

Description

@bvaughn

I'm currently updating the new React DevTools to use suspense for more interactions (bvaughn/react-devtools-experimental#196). This has uncovered three pain points that we should try to address:

  1. Using the "two setState pattern" can be awkward if the priority is "normal" or higher (as was the case in my "keydown" event handler) because scheduler.next uses "normal" priority for this case. (This also applies to e.g. non-React event handlers, since the default priority for these is "normal" as well.) Temporary workaround - manually run the first update with user-blocking priority.

  2. Offscreen updates cause user-blocking and normal priority work to be batched together (for unknown reasons). This makes interactions feel unresponsive. Temporary workaround - none (other than to stop using offscreen priority).

  3. Fallback UI shown too quickly. One of the main reasons to use suspense in the "inspected element" panel to begin with is to avoid a quick flash of the "Loading..." fallback when a new element is selected. However, it seems like this is still happening even with suspense. Temporary workaround - none, since I don't know the cause.

Edit I think the first two items I reported were caused by a second/duplicate scheduler package that had gotten installed in DevTools as a transient dependency.

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