T
TanStack3y ago
extended-salmon

Solid-Query getQueryState result isn't reactive

I'm calling queryClient.getQueryState(['current-user'])?.status === 'error' in a Match statement but despite the query erroring, the conditional never renders In order to account for this I hacked it into an effect
let timerId: number | undefined;
createEffect(() => {
timerId = setInterval(() => {
setUserWasError(queryClient.getQueryState(['current-user'])?.status === 'error');
});
}, 500);

onCleanup(() => {
clearInterval(timerId);
});
let timerId: number | undefined;
createEffect(() => {
timerId = setInterval(() => {
setUserWasError(queryClient.getQueryState(['current-user'])?.status === 'error');
});
}, 500);

onCleanup(() => {
clearInterval(timerId);
});
But this seems bad. Is there a better way?
2 Replies
future-harlequin
future-harlequin3y ago
we have a #solid-query-questions channel for solid specific questions ...
extended-salmon
extended-salmonOP3y ago
Thank you!

Did you find this page helpful?