Description
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:
-
Using the "twosetState
pattern" can be awkward if the priority is "normal" or higher (as was the case in my "keydown" event handler) becausescheduler.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. -
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). -
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.