Is there a way to keep the pending status when using initialData/placeholder? #261
-
I need to track if the query has responded for the first time while still using initialData/placeholder to have the state start with an empty array. If I use either It always returns "success" even if the first query execution has not yet finished. A workaround is creating a computed like data ?? [] and stop using initialData/placeholder, but just checking if this is already handled by Pinia Colada in any other way. This makes using initialData/placeholder a lot harder. The reason I do this is to avoid checking for null everywhere when I have logic that works with an empty array or other initial states. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Using a local computed seems like a good solution. You could also add a plugin that adds the property you want to on the actions |
Beta Was this translation helpful? Give feedback.
Using a local computed seems like a good solution. You could also add a plugin that adds the property you want to on the actions
create
/extend
andfetch
. Take a look at the plugins folder, (e.g. https://github.com/posva/pinia-colada/blob/main/plugins/delay/src/index.ts)