Rara types in the finder, a slow list of 60 puppets filters: directly, through startTransition, or through useDeferredValue. When does each letter reach the…
Search as you type, a big table filter, a tab that draws many charts: one keystroke can drag a heavy render along. If that render is one update with the box’s text, every letter waits, and the app feels stuck. Marking the heavy render as one that may wait keeps the box smooth with no web worker or debounce.
One keystroke, two updates: the urgent one and the one that may wait
setTeks (the typed value) inside startTransition A controlled input’s value must update at once. Inside a transition React sets the box back to the old value until the transition is done: letters vanish and turn up later. Wrap only the heavy update (setQuery).startTransition is a debounce It is not: there is no delay, its render starts at once. The difference is that a transition’s render can be interrupted: a new keystroke throws away the render that was not done, and React goes on with the newest value. Each render does the same work; to cut the work, use a debounce or memo.useTransition When the value comes from props or state that is not yours, useDeferredValue(value) is simpler: no second setter needed. useTransition is for when you trigger the update yourself.startTransition is in, yet the box still stutters The urgent render for setTeks still renders its component’s children again. Without memo, the heavy list renders too, with the old query, and the box waits again. Wrap the list in memo (the React docs’ example does too).setQuery(x) directly: have Rara type Each letter waits for the list to finish rendering; the delays pile up.startTransition: type again Letters at once, isPending true while the list catches up.useDeferredValue(teks) The same result with no second setter: the list lags a moment.