TanStackT
TanStack3y ago
2 replies
visible-brown

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);
  });


But this seems bad. Is there a better way?
Was this page helpful?