It seems to me that isLoading should be true by default.
If you have the following:
const MyComponent = () => {
const {isLoading, data} = useQuery("todos", fetchTodos);
if(isLoading) {
return <Spinner />;
}
if(!data) {
return "You don't have any todos";
}
return <div>Your todos: {data}</div>
}
Currently in with this code you will see a flash of "you don't have any todos", followed by the spinner, followed by Your todos: foo. We want our UX to be just followed by the data, w/out the flash of empty data content first.
As far as I could tell there's nothing in the api that allows you to set the initial state to 'isLoading' to be true. Is there any way to accomplish this?
It seems to me that isLoading should be true by default.
If you have the following:
Currently in with this code you will see a flash of "you don't have any todos", followed by the spinner, followed by
Your todos: foo. We want our UX to be just followed by the data, w/out the flash of empty data content first.As far as I could tell there's nothing in the api that allows you to set the initial state to 'isLoading' to be true. Is there any way to accomplish this?