useTransition at the same level as useQueryState briefly reverts to the previous value — known limitation or bug? #1505
ContextI isolated this behavior in a minimal repro after encountering it in a real application: filters where the user-selected value briefly jumps back to the previous value before finally settling on the new one. I want to know whether this is a known limitation, unsupported usage, or a bug. ReproductionSandbox: https://codesandbox.io/p/sandbox/7834g5 Important: this momentary revert only reproduces reliably without React Failing case: function App() {
const [isPending, startTransition] = useTransition()
const [count, setCount] = useQueryState(
'count',
parseAsInteger.withDefault(0),
)
useEffect(() => {
console.log('rendered with count', count)
}, [count])
return (
<button
disabled={isPending}
onClick={() => {
startTransition(() => {
setCount((c) => c + 1)
})
}}
>
{isPending ? '…' : '+ App transition'}
</button>
)
}Observed log when running the linked sandbox (
As shown above, after the click the committed value goes 267 → 266 → 267, coinciding with the period where For comparison, if What I think is happening (could be wrong)
This also fits an Actions-style button: if the pending UI is driven by Why a discussion?The documentation passes Questions
Environment
|
Replies: 3 comments
|
I also put together a second sandbox that adds Suspense + With that setup I’m seeing other inconsistencies beyond the
Still the same underlying question: how (Same note as before: easier to judge without I’m also raising this with React’s async / Actions direction in mind. As that model spreads, component libraries will increasingly expose |
|
As a general tip, you can await the result of the state updater function within startTransition to keep its pending status stable until the URL has finished updating. |

I turned this into an issue in #1506.