Highlights of This Release
1. More Tests and Better Code Coverage
We now have 23 test suits of 202 total test cases, with a 98.06% test coverage. The core files and main functionalities are now 100% covered. Kudos to @promer94 for improving it!
2. Use the Latest Fetcher Function
SWR will now use the latest fetcher function passed to the hook, when sending the request. Previously it uses the initial snapshotted fetcher.
3. Avoid Unnecessary Auto Revalidations
When refocusing on the window with state changes (like clicking a button that changes the SWR key immediately), SWR now avoids revalidations if they're not necessary. Details can be found in #1720.
4. New Types for useSWRInfinite
Two types for useSWRInfinite
are added: SWRInfinteHook
and SWRInfinteKeyLoader
. You can use them to type the hook and the getKey
function.
What's Changed
- type(infinite): export SWRInfinteHook and InfiniteKeyLoader from infinite by @houkanshan in #1714
- feat: Ensure auto revalidations are executed after state updates by @shuding in #1720
- Add moduleNameMapper to jest by @shuding in #1724
- Improve test by @promer94 in #1725
- feat: Use the latest reference of fetcher by @shuding in #1727
New Contributors
- @houkanshan made their first contribution in #1714
Full Changelog: 1.1.2-beta.0...1.1.2-beta.1