empty data on refetch error
I have a simple useQuery that on success shows the correct data, but on error is returning empty.
If the example api returns a 500 the data is now an object with error in it. However I would like to keep the previous data (was a feature in v4 I believe).
This query is inside a custom hook and just returns
Since the hook returns data.timeEntires it then defaults to [] since timeEntires doesn't exist on the error data object.
@tanstack/react-query - ^5.18.1
If the example api returns a 500 the data is now an object with error in it. However I would like to keep the previous data (was a feature in v4 I believe).
This query is inside a custom hook and just returns
Since the hook returns data.timeEntires it then defaults to [] since timeEntires doesn't exist on the error data object.
@tanstack/react-query - ^5.18.1