Concurrent Store

What a store guarantees under concurrent React

You will learn

React’s documentation advises against suspending a render on a value read with useSyncExternalStore. A mutation to an external store cannot be marked as a Transition, so it triggers the nearest Suspense fallback and replaces content that is already on screen. It also notes that a store mutated during a Transition makes React redo that update as a blocking one.

Every panel below suspends on a store value on purpose. These are the six guarantees that makes possible.

Rebasing

A blocking update applies to what is on screen

Each letter is an action.

on screenstore
idle
Click the buttons, or press Run

Tearing

A component mounting mid-Transition shows what its siblings show

gated1
agreementno readers
idle
Click the buttons, or press Run

Suspense

A Transition must not produce a fallback

readerada
idle
Click the buttons, or press Run

Error boundaries

Resetting one needs the store to move on

readerada
idle
Click the buttons, or press Run

Selectors

A selector can skip its own render

nameadaunread0badgenonethemedark
idle
Click the buttons, or press Run

Multiple roots

One store can serve two roots with no provider

root A1
agreementno readers
idle
Click the buttons, or press Run