How to keep placeholder data if the initial fetch fails
If the initial fetch fails, is there a way to keep the
placeholderData (note, i cant use initialData as it messes up with my stale time option) instead of data becoming undefined. I want placeholderData to be empty array, but as soon as the fetch fails, it becomes undefined which breaks my UI. No matter how i structure my query function, the data always becomes undefined and I have to use conditional chaining.2 Replies
fascinating-indigo•3y ago
const { data = [] } = useQuery(...rising-crimsonOP•3y ago
Thanks @TkDodo 🔮 ...