swr
swr copied to clipboard
React Hooks for Data Fetching
# Bug report ## Description / Observed Behavior We are using SWR in a react-native application with react-navigation. React Navigation stack navigator allows multiple screens to be mounted with one...
Hi! While using swr 2.0, I felt uncomfortable that extgraArg could not be used in onSuccess and onError. So I suggest you can use extraArg in onSuccess and onError like...
# Bug report ## Description / Observed Behavior ```ts const { data } = useSWR( condition ? null : 'url', { suspense: true } ); ``` Since [email protected] with the...
# Bug report ## Description / Observed Behavior I am using `useSWRInfinite` with `getKey`, which returns an array. When using the global `mutate` from `useSWRConfig`, I'm passing a function to...
fix https://github.com/vercel/swr/issues/2482 This PR can clarify `SWRResponse` type allows you to asser response types in TypeScript ```tsx function App () { const {data,isLoading,error,isValidating} = useSWR('/api') if(error){ return (....) } if(isLoading){...
Fixes #2155 and an alternative of #2240 This changes to use the fetcher argument rather than overriding by `config.fetcher` even if the argument is `null`. `config.fetcher` is still used when...
# Bug report ## Description / Observed Behavior Suspense is enabled when calling `useSWR`, and an error is thrown inside the fetcher function when attempting to fetch. The error isn't...
This commit updates the type definition of the Cache object to align with the native JavaScript Map data structure. This offers users access to clear method available on Map. cache.clear():...
# PR description Check if config.fallback is undefined. If config.fallback is undefined, don't access to config.fallback[key]. # Issue reference - Closes #2912
The sample code at here: ```` const {data, error, isLoading} = useSWR(['passport/session/get'], () => get_session()) if (!isLoading && error == null) { console.log(data.user_id) } ```` ![image](https://github.com/vercel/swr/assets/11588555/51a5a641-216d-4d32-9deb-2eb743e7fbe5) In my opinion, I...