#Route Action: Show "busy" status?

1 messages · Page 1 of 1 (latest)

flat breach
#

Hopefully and easy one - thanks in advance for the help 🙏

What's the recommended way to show a "loading" or "busy" state after the user submits a form to a route's action?

is it just a matter of building up an object showing state - e.g. { data, error, isBusy } - returning that in the action, and then using useActionData() to pull that into the component?

#

hm. actually i don't think that'd work b/c the action only returns one thing - presumably success or failure.

i suppose the loader itself would then need to re-run to grab latest server state and i'd have to hook into that to show "busy" 🤔

brisk mantle
#

you can use useNavigation hook to know if there's a pending navigation (like a pending action)

#

if you used useFetcher the same fetcher has the state

flat breach
#

ah, nice. thanks 🙏