posva / pinia-colada

🍹 The smart data fetching layer for Pinia
https://pinia-colada.esm.dev/
MIT License
583 stars 6 forks source link

Add a placeholder data option #57

Open minht11 opened 3 days ago

minht11 commented 3 days ago

Loading spinners are bad, it less disruptive to show users previous data until new data is ready. Suspense is somewhat based on that idea.

Have code like this:

const { data } = useQuery({
    key: () => ['item', props.selectedItemId],
    query: () => getItemById(props.selectedItemId),
})

when props.selectedItemId changes current behavior of useQuery forces me to show blank screen because data does not exist, I wish data would not be reset while isFetching is true.

posva commented 3 days ago

It’s normal it’s not kept by default. But maybe a placeholder option could add this

Notes: