Is `data` always meant to be possibly undefined
Even when using even when using keepPreviousData and
placeholderData?
Should data.value (Vue) be possible undefined in this case? As far as I know, with this set up, it will never not be defined right?3 Replies
extended-salmon•3y ago
yes, placeholderData is no guarantee that there will always be data. if the query fails, data will be undefined: https://tkdodo.eu/blog/placeholder-and-initial-data-in-react-query
Placeholder and Initial Data in React Query
Learn about the different possibilities to avoid loading spinners in React Query.
correct-apricotOP•3y ago
Ah okay that makes sense. So really there's no way to ensure the
data is always defined is there?
Just trying to battle best way where I had a dsahboard with heaps of async calls to stats (10+ endpoints) and all that data loads at different times, but if I use some placeholder data, my graphs etc still populate and I don't get all the jumping around
Except I still get a litany of TS errorsextended-salmon•3y ago
it is defined if you set initialData