useSubmission pending state resolves on url change?
i have some optimistic ui, with roughly the following structure:
then somewhere else i use
useSubmission(save)
and disable buttons based on pending
state as i don't want user's editing lists that aren't accurate to server state.
the weird thing is, when i include the logic above with the **
, the useSubmission state basically dies. it returns to undefined, and my buttons are don't disabled
if instead i wait to set view -> "read"
until after i've checked the result of the server call, then the pending
state works perfectly (which i can't really do, otherwise the illusion of the optimistic ui is gone)
wondering if this is expected, or perhaps i'm doing something wrong? I can post code tomorrow if this doesn't make sense, thanks!2 Replies
without code, this is difficult.
Actions do revalidate all cached functions, unless you tell it not to.
Maybe you can provide a stack blitz with minimal reproduction.
It’s not really the revalidation that’s my issue but yes I can show some code later
important point:
args.setView()
updates searchParams. i think this is messing up action state for some reason
and this is the code i pass down to my buttons via props to use for disabled attr
Update: Almost positive it's a result of the url change; when i remove the url from the picture and just have it be a signal toggle, the pending state works properly