You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a query (call them B, see below), which is initally not loading, and is loading and at the end is not loading again (as expected) when there is data, see screenshot with logging information:
I figured out, that it seems originating from the conditional query I use:
is call query (A), while this the key of query (B) is null, to be disdabled.
when query (A) has data, these are used as args for query (B), so key becomes defined now.
With this pattern I observe the above mentioned bug, so I have to check isLoading and data, to be failsafe.
I am coming from tanstack/query, where you have more options like enable queries or have more then just one loading state, so maybe I am doing s.th. wrong? So please let me know.
Otherwise I would suggest to change isLoading state to take into account, that data !== undefined.
Additional Context
SWR version: 2.2.5
Next: 14.2.5
React: 18.2.0
The text was updated successfully, but these errors were encountered:
fmacherey
changed the title
isLoading is initially false when there is no data.
isLoading is initially false when there is no data for conditional queries.
Jul 19, 2024
Bug report
I have a query (call them B, see below), which is initally not loading, and is loading and at the end is not loading again (as expected) when there is data, see screenshot with logging information:
I figured out, that it seems originating from the conditional query I use:
key
of query (B) is null, to be disdabled.key
becomes defined now.I am coming from tanstack/query, where you have more options like enable queries or have more then just one loading state, so maybe I am doing s.th. wrong? So please let me know.
Otherwise I would suggest to change isLoading state to take into account, that
data !== undefined
.Additional Context
SWR version: 2.2.5
Next: 14.2.5
React: 18.2.0
The text was updated successfully, but these errors were encountered: