Best practice around using `useDeferredValue` on mutation status?
This could very well have a very straightforward answer but basically I have a component that conditionally renders its content based on a mutation's status. However, the design of the UX means that there can be a pretty jarring flash of content as the status goes from
idle
to pending
to error
.
From what I can tell, using const deferredStatus = useDeferredValue(mutation.status)
solves this flashing issue perfectly! Unfortunately, it means that I don't get the type narrowing of the original mutation
when trying to use it within the conditional render. Is that just something I have to accept and work around?
I tried wrapping the whole mutation i.e. useDeferredValue(mutation)
, which seemed to work, but it felt wrong to do that given that it's not really a scalar primitive value as suggested by the React docs to use0 Replies