Releases: vercel/swr
Releases Β· vercel/swr
v2.1.3
What's Changed
- Fix #2548: pass origin key to subcription callback by @Zheaoli in #2550
- Examples: fix type in axios-typescript example by @daochouwangu in #2552
- Update Cache Interface types by @dmmulroy in #2554
- fix: data passed to refreshInterval function is not latest by @hong24 in #2354
- types: allow passing function as
Data
foruseSWRSubscriptionOptions
by @promer94 in #2551
New Contributors
- @Zheaoli made their first contribution in #2550
- @daochouwangu made their first contribution in #2552
- @dmmulroy made their first contribution in #2554
Full Changelog: v2.1.2...v2.1.3
v2.1.2
Patches
- Improved type inferring for
swr/subscription
- Adding
SWRSubscriptionOptions
type forswr/subscription
Changes
- test: add typing test for empty config by @koba04 in #2521
- test: fix syntax error in Equal type alias implementation by @SACHINnANYAKKARA in #2517
- chore: remove engines by @promer94 in #2536
- types: improve
useSWRSubscription
types by @promer94 in #2535 - Rename subscription types by @huozhi in #2537
New Contributors
- @SACHINnANYAKKARA made their first contribution in #2517
Full Changelog: v2.1.1...v2.1.2
v2.1.1
Patches
- refactor: remove useless dataRef, always compare cached data by @promer94 in #2431
- fix: swr infers incorrect
data
type for defaultSWRConfig
generic type by @connorch in #2506
Documentation
New Contributors
Full Changelog: v2.1.0...v2.1.1
v2.1.0
Feature
Checkout subscription docs and useSWRInfinite parallel fetching docs for more details
Patches
- fix: use the latest config in useSWRMutation by @koba04 in #2468
- Fix: type support for suspense and fallbackData(#2396) by @taro-28 in #2452
- Error should be reset when new data comes by @huozhi in #2472
- fix: avoid creating new snapshot if cache is not updated at client during streaming by @promer94 in #2475
- refactor: initialize the cache only on first access by @promer94 in #2479
Misc
- ci: fix publish workflow by @promer94 in #2453
- ci: faster e2e test by @promer94 in #2428
- test: add a test for keepPreviousData without changing key by @koba04 in #2470
- Always assume subscriptions will return sub count from current key by @huozhi in #2460
- test: Fix flaky e2e test by @promer94 in #2476
- chore: Add subscription example by @huozhi in #2480
New Contributors
Full Changelog: v2.0.4...v2.1.0
v2.0.4
Patches
- build: fix release job condition by @huozhi in #2392
- types: fix some mutation type issue by @promer94 in #2421
- fix: Error retry should be handled by global revalidator instead of local revalidation function by @promer94 in #2415
- fix: ensure initCache setter function stays within bounds of subscriptions by @lfbergee in #2411
Misc
New Contributors
Full Changelog: v2.0.3...v2.0.4
v2.0.3
Patches
- fix: parameters passed to subscribe is inconsistent with its declaration by @hong24 in #2353
- fix: when inifinite key changes, should use cached pagesize instead of initialSize by @promer94 in #2386
- fix: make compare function only compare data (#2375) by @Retrospection and @promer94 in #2387 #2389
- fix: initial loading state should be false with revalidation is disabed by @promer94 in #2382
- fix: Ensure hydration matches the SSR result during streaming by @shuding in #2391
Chores
- ci: only run release when tags pushed by @promer94 in #2388
- unify
-
characters in README.md by @jankaifer in #2334
New Contributors
- @hong24 made their first contribution in #2353
- @Retrospection made their first contribution in #2387
- @jankaifer made their first contribution in #2334
Full Changelog: v2.0.2...v2.0.3
v2.0.2
v2.0.1
In this patch release, we majorly improved typing support and SWR can infer the types based on the configuration.
- When the
suspense
option istrue
, the returneddata
will excludeundefined
and theisLoading
will always befalse
. - When the
fallbackData
option is provided, the returneddata
will be the same type offallbackData
, and theisLoading
will always befalse
.
Here's a demo for it:
swr-2.0.1.mp4
What's Changed
- types: make FullConfiguration generic by @huozhi in #2273
- type: enforce array literal as tuple by @promer94 in #2283
- Improve type test by @promer94 in #2289
- update bunchee to remove the extra target cli option by @huozhi in #2298
- fix: useSWRMutation should always use the latest fetcher by @koba04 in #2290
- types: conditional swr response by @huozhi in #2301
- fix: types properites in exports fields by @koba04 in #2341
- Update license year by @IcedMonk in #2344
- feat: add all mutate options support to useSWRInfinite by @koba04 in #2350
- ci: add publint to check packaging on CI by @koba04 in #2363
New Contributors
Full Changelog: 2.0.0...v2.0.1
2.0.0
Announcing SWR 2.0
We are excited to announce the release of SWR 2.0! The new version comes with a lot of improvements:
- New useSWRMutation hook
- Enhanced mutation and optimistic UI capabilities
- SWR DevTools
- Preload resource
- Improved React 18 support
And more!
Read our blog post and migration guide: https://swr.vercel.app/blog/swr-v2
What's Changed
- bugfix: make suspense and revalidateIfStale work together by @simowe in #1851
- feat: support functional optimisticData by @huozhi in #1861
- test: fix an act warning by @koba04 in #1888
- breaking: Change the fetcher argument to be consistent with the passed key by @shuding in #1864
- Keep all fields with one single key by @shuding in #1863
- fix: wrong spell by @baojie223 in #1902
- Update React 18 dependencies by @shuding in #1824
- build(deps): bump minimist from 1.2.5 to 1.2.6 by @dependabot in #1903
- type: make type inference simpler by @promer94 in #1908
- type: fix type error on SWRConfig by @himself65 in #1913
- feat: Hook for remote mutations by @shuding in #1450
- Add isFallback state by @shuding in #1925
- build: output mutation cjs bundle with named exports by @huozhi in #1926
- Add
isLoading
state and refactor the core by @shuding in #1928 - Add
keepPreviousData
option by @shuding in #1929 - types: drop legacy types by @huozhi in #1930
- breaking: Throw error when using suspense on the server side without fallback in React 18 by @shuding in #1931
- type: extends useConfig cache interface by @promer94 in #1938
- remove mount check for react18 by @promer94 in #1927
- lint: dont check unused vars with underscore prefix by @huozhi in #1939
- test: upgrade to jest 28 by @huozhi in #1942
- Fix cache types by @chibicode in #1961
- Improved React 18 support by @promer94 in #1962
- types: fix type regressions by @promer94 in #1966
- fix: mutate args for useSWRInfinite hook by @sanjeev29 in #1947
- build: import with-selector with extension from useESE by @huozhi in #1967
- Bug fixes by @shuding in #1968
- chore: Faster type checking by @shuding in #1969
- fix: try fix codesanbox ci import error by @promer94 in #1971
- Fix race conditions related to optimistic UI by @shuding in #1970
- chore: Add test cases for mutate by @shuding in #1976
- fix: Should always reset to the original data after mutating with optimistic data by @shuding in #1982
- refactor: remove useless ref copy by @promer94 in #1981
- chore: switch to pnpm and turborepo by @promer94 in #1983
- fix: should only update cache when actually start new request by @promer94 in #1986
- chore: save some bytes by @promer94 in #1991
- fix: useSWRMutation - clear error after successful trigger (#1973) by @anirudh1713 in #1995
- Fix typo: getSWRCacahe -> getSWRCache by @sdornan in #2000
- build: do not abort on watch mode when ts erroring by @huozhi in #1992
- chore: add engine field to limit pnpm version by @huozhi in #1990
- test: add test case for #1974 by @promer94 in #2005
- fix: Adding debounce for autocomplete-suggestions example by @Walkeryr in #2017
- BREAKING: rename SWRConfig.default to SWRConfig.defaultValue by @huozhi in #2023
- feat: support functional swr context config by @huozhi in #2024
- test: fix all act warnings by @koba04 in #2031
- feat: add preload function by @koba04 in #2026
- fix: Avoid preloading the resource multiple times by @shuding in #2036
- fix: isLoading and isValidating should always respect cache value by @promer94 in #2048
- Fix ts type generation by @huozhi in #2038
- feat: mutate filter by @huozhi in #1989
- Fix typos by @hiro0218 in #2052
- feat: add DevTools hook by @koba04 in #2016
- Use consistent typing imports by @huozhi in #2061
- Upgrading use-sync-external-store lib by @sanjaiyan-dev in #2063
- Revert swr config generic by @huozhi in #2065
- Fix: raf return type by @huozhi in #2074
- Remove unused info from dummy package.json by @huozhi in #2083
- Use pnpm workspace by @huozhi in #2085
- bump typescript and apply nodenext module resolution by @huozhi in #2084
- Chore: Typos and grammar by @AllanOliveiraM in #2094
- chore: add basic tsdoc by @promer94 in #2089
- types: add generic for SWRInfiniteKeyLoader by @jason89521 in #2104
- fix: add swr/_internal to paths by @jason89521 in #2105
- type: make tsconfig simpler and fix type error by @promer94 in #2115
- chore: exclude .tsbuildinfo from files, reduce install size by @promer94 in #2119
- Reorder exports conditions by @huozhi in #2130
- Upgrade bunchee by @huozhi in #2132
- Bump typescript and assemble pnpm scripts by @huozhi in #2133
- chore: add github actions reporter by @promer94 in #2131
- Dedupe installed swc by @huozhi in #2136
- test: add a test for preload API in effects by @koba04 in #2138
- test: add more isLoading tests for the case a key is null or an error by @koba04 in #2141
- ci: use action/setup-node built-in pnpm cache and bump to node16 by @promer94 in #2142
- test: add tests for dependency collection by @koba04 in #2140
- chore: bump dev deps by @huozhi in #2143
- memoize config values to avoid frequent context propagation by @gnoff in #2149
- Bundle types into one file by @huozhi in #2150
- Revert target option by @huozhi in #2151
- chore: fix missing husky warning by @huozhi in #2160
- Remove downlevelIteration and traverse iterator manually by @huozhi in #2181
- fix: re-render when returned data and fallbackData is the same and keepPreviousData is enabled by @koba04 in #2169
- breaking: Change the error broadcasting behavior in mutations and add
throwOnError
option by @shuding in #2182 - docs: Add JSDoc comments to useSWRMutation by @shuding in #2183
- type: export MutationFetcher by @ssssota in #2184
- Bump bundler by @huozhi in #2187
- resolve swr internal imports as external by @huozhi in #2225
- test: update tests alias to swr subpath exports by @huozhi in #2243
- feat: support functional rollbackOnError by @huozhi in #2242
- Update build target to es2018 by @shuding in #2249
- Fix missing esmodule mark in cjs build by @huozhi in #2251
- fix: pass null fetcher to middleware by @koba04 in #2240
New Contributors
- @simowe made their first contribution in #1851
- @baojie223 made their first contribution in #1902
- @himself65 made their first contribution in #1913
- @chibicode made their first contribution in #1961
- @sanjeev29 made their first contribution in #1947
- @sdornan made their first contribution in #2000
- @Walkeryr made their first contribution in #2017
- @hiro0218 made their first contribution in #2052
- @sanjaiyan-dev ma...
2.0.0-rc.3
What's Changed
- Fix missing esmodule mark in cjs build by @huozhi in #2251
- fix: pass null fetcher to middleware by @koba04 in #2240
Full Changelog: 2.0.0-rc.1...2.0.0-rc.3