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
Document states that when isReady is false, data is undefined.So if key will be Falsy, then data type should be guessed as Data | undefined.
functionProfile(){const{ data }=useSWR(isReady ? '/api/user' : null,fetcher,{suspense: true})// `data` will be `undefined` if `isReady` is false// ...}
However, in version 2.0.1, it is presumed to be Data. And when key is Falsy, an error occurs.
Which behavior do you plan to proceed as positive in SWR?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Document states that when
isReady
is false,data
isundefined
.So ifkey
will be Falsy, thendata
type should be guessed asData | undefined
.However, in version 2.0.1, it is presumed to be
Data
. And whenkey
is Falsy, an error occurs.Which behavior do you plan to proceed as positive in SWR?
Beta Was this translation helpful? Give feedback.
All reactions