swr

React Hooks for Data Fetching

MIT License

Downloads
9.7M
Stars
29.3K
Committers
182

Bot releases are visible (Hide)

swr -

Published by shuding about 3 years ago

Minor Changes

  • Should treat key change as remount: #1430

Patches

  • Test: add tests for a global cache: #1421
  • Chore: always use config ref: #1397
  • Typing: use separated constants instead of enum: #1425

Credits

Huge thanks to @koba04 and @huozhi for helping!

swr -

Published by shuding about 3 years ago

Minor Changes

  • Feat: add a warning for invalid arguments with suspense mode: #1402
  • Export KeyedMutator type from root export: #1406

Patches

  • Fix typo in test: #1393
  • Chore: remove isomorphic-unfetch from examples: #1389
  • Chore: bump swr to latest in examples: #1394
  • Fix: isValidating when an error occurred: #1396
  • Fix: useSWRConfig is exported as () => any type: #1409
  • Fix: isValidating cache inconsistence in mutatation: #1411
  • Refactor: use TestSWRConfig for error-test: #1404

Credits

Huge thanks to @louisgv, @willheslam, @koba04, @huozhi, and @origin-master for helping!

swr -

Published by shuding about 3 years ago

Minor Changes & Breaking Changes

See full changes of this major & previous beta updates on the Releases page. Also read our blog post and migration guide: https://swr.vercel.app/blog/swr-v1.

Patches

  • Chore: add test to ensure the unserialized key is passed to middleware: #1384
  • Chore(examples): update all examples to use v1: #1385

Credits

Huge thanks to @koba04 for helping!

swr -

Published by shuding about 3 years ago

Patches

  • Doc: update fallbackData usage examples: #1380
  • Fix bound mutate: #1383

Credits

Huge thanks to @huozhi and @karaggeorge for helping!

swr -

Published by shuding about 3 years ago

Patches

  • Chore: add test for callback setSize: #1373
  • Fix: cache is missing on server side: #1377
  • Rm deprecated warning: #1374
  • Add basic test for node env: #1378
  • [Infinite] Return current data if failed to resolve pages from cache when setting size: #1379
  • Rename revalidateWhenStale: #1381

Credits

Huge thanks to @huozhi for helping!

swr -

Published by shuding about 3 years ago

Major Changes

  • New useSWRConfig API and remove createCache: #1361
  • Rename middlewares option to use: #1368
  • Rename fallbackValues to fallback; rename initialData to fallbackData: #1370

Minor Changes

  • Replace Object.defineProperties with getter: #1371
  • Update README and CONTRIBUTING: #656

Patches

  • Improve tests for cache provider: #1369

Credits

Huge thanks to @huozhi and @pacocoursey for helping!

swr -

Published by shuding about 3 years ago

Patches

  • Add beta publish script: #1351
  • Fix: isValidating should be false when no fetcher is provided: #1352
  • Upgrade bunchee, dedupe yarn lock: #1358
  • Reverse middleware order: #1360

Credits

Huge thanks to @huozhi for helping!

swr -

Published by shuding about 3 years ago

Minor Changes

  • Export unstable_serialize from SWR: #1337

Patches

  • Fix type of MutatorCallback: #1342
  • Improvement: return stale data then revalidate when setting size of useSWRInfinite: #1343
  • Lint-staged: remove lint, fix prettier: #1347
  • Local devdelopment with examples: #1330
  • Fix: alias swr in next client bundle on dev mode: #1349
  • Refactor code structure: #1350

Credits

Huge thanks to @huozhi for helping!

swr -

Published by shuding about 3 years ago

Major Changes

  • BREAKING: Deprecate revalidate with mutate: #1332

Minor Changes

  • Improvement: ensure useSWRInfinite reuses useSWR cache: #1341

Patches

  • Code refactoring: #1307
  • Add package.json to module exports: #1313
  • Fix config being ignored when fetcher is null: #1311
  • Reset cache between tests: #1309
  • Refine the infinite hook: #1315
  • Test: add a test for getInfiniteKey with current data: #1319
  • Update bunchee 1.6.2: #1323
  • Chore: update useSWRInfinite import: #1326
  • Upgrade bunchee, reduce node_modules size: #1329
  • Build(deps): bump path-parse from 1.0.6 to 1.0.7: #1334

Credits

Huge thanks to @huozhi, @heysailor, @koba04, and @eric-hc for helping!

swr -

Published by shuding about 3 years ago

Major Changes

  • Move infinite types to swr/infinite and deprecate old ones: #1272
  • Drop legacy types: #1276
  • Breaking: drop the default fetcher: #1304

Minor Changes

  • Feat: add getInfiniteKey to mutate the cache for useSWRInfinite: #1257
  • Rename isDocumentVisible to isVisible: #1308

Patches

  • Fix types generate: #1266
  • Add test case that covers #1286: #1297
  • Enhance: simplify deno detection: #1299
  • Refine createCache: #1283
  • Fix useSWRInfinite doesn't revalidate the first page: #1301
  • Code structure refactoring: #1303

Credits

Huge thanks to @huozhi and @koba04 for helping!

swr -

Published by shuding over 3 years ago

Major Changes

  • Sub-packages and immutable hook: #992

Patches

  • Add condition to check if window.addEventListener exists for React Native compatibility: #1234
  • Chore: bump typescript to use ts-expect-error instead of ts-ignore: #1239
  • Enhance: add $ prefix for non-major keys: #1174
  • Fix: fail accessing navigator on Node: #1254
  • Chore: fix to run the build script multiple times: #1255
  • Test: run concurrent rendering tests with React v18 alpha: #1259
  • Fix: ignore .d.ts in dist/ for ESLint: #1258
  • Enhance: use ts for testing: #1260
  • Chore: add watch scripts for sub packages to build them: #1261
  • Fix typo in use-swr: #1267
  • Chore: fix type SWRHookWithdMiddleware to SWRHookWithMiddleware: #1268

Credits

Huge thanks to @javascripter, @koba04, @huozhi, and @pa-rang for helping!

swr -

Published by shuding over 3 years ago

Minor Changes

  • Adopt bunchee as bundler: #1025
  • Custom cache provider: #1017
  • Middleware: #1160

Patches

  • Test: refactor use-swr-loading.test.tsx: #1057
  • Test: refactor use-swr-local-mutation.test.tsx: #1059
  • Fix #1056: #1058
  • Test: refactor use-swr-offline.test.tsx: #1063
  • Allow setting the generic on mutate(): #1069
  • Read cache during render: #794
  • Code refactoring: #1077
  • Add --no-sourcemap: #1079
  • Fix mutate: #1075
  • Revert #1024: #1085
  • Fix: race problem when in dedupingInterval: #1088
  • Bug fixes: #1096
  • Test: refactor use-swr-refresh.test.tsx: #1103
  • Docs: optimistic UI examples comments more clearer: #1102
  • Fix setting null cache in useSWRInfinite: #1110
  • Test: refactor use-swr-revalidate.test.tsx: #1111
  • Test: refactor use-swr-suspense.test.tsx: #1113
  • Build: upragde bundler: #1121
  • Replace deprecated types with latest types in axios-typescript example: #1128
  • Add saveData to slowConnection: #1130
  • Clean code: #1145
  • Update bound mutate readme: #1127
  • Code optimizations: #1150
  • Enhance: support exports field: #1154
  • Fix global mutate generic: #1159
  • Build(deps): bump hosted-git-info from 2.8.5 to 2.8.9: #1164
  • Enhance: upgrade ts lint config: #1169
  • Build(deps): bump browserslist from 4.16.3 to 4.16.6: #1181
  • Fix: autocomplete suggestions example: #1183
  • Build(deps): bump ws from 7.4.2 to 7.4.6: #1184
  • Update README.md: #1203
  • Fix typo in placeholder: #1206
  • Update package.json: #1205
  • Build(deps): bump acorn from 6.3.0 to 6.4.2: #1210
  • Build(deps): bump y18n from 4.0.0 to 4.0.3: #1209
  • Build(deps): bump lodash from 4.17.19 to 4.17.21: #1208
  • Build(deps): bump glob-parent from 5.1.0 to 5.1.2: #1207
  • Add codeowner @huozhi: #1221

Credits

Huge thanks to @huozhi, @koba04, @promer94, @nstepien, @MoonBall, @mkrtchian, @eunsukimme, @Tak-Iwamoto, @meeoh, and @teinett for helping!

swr -

Published by shuding over 3 years ago

Patches

  • fix #1056: #1058

Credits

Huge thanks to @promer94 for helping!

swr -

Published by shuding over 3 years ago

Patches

  • Refactor: fix a react-hooks/exhaustive-deps warning: #1035
  • Test: refactor use-swr-focus.test.tsx: #1036
  • Test: refactor use-swr-infinite.test.tsx: #1039
  • Export default SWR config to allow more flexible extensions: #1023
  • Test: refactor use-swr-integration.test.tsx: #1049
  • Fix: invalid invocation on raf: #1051
  • Types: expose KeyLoader: #1054
  • Test: refactor use-swr-key.test.tsx: #1055

Credits

Huge thanks to @koba04, @jakubriedl, and @huozhi for helping!

swr -

Published by shuding over 3 years ago

Patches

  • Fix dequal vendor: #1027
  • Test: refactor tests for configs: #1006
  • Test: refactor use-swr-error.test.tsx: #1031
  • Micro optimizations: #1018
  • Fix: support multiple useSWRInfinite hooks in a page: #1009

Credits

Huge thanks to @promer94 and @koba04 for helping!

swr -

Published by shuding over 3 years ago

Patches

  • Fix: revalidate with initialData when changing the key: #961
  • Update CODEOWNERS: dd1bcf99daeacb167b31a7da9547c39ae4452d95
  • Allow passing undefined config: #1022
  • Make swr zero dependency: #1024

Credits

Huge thanks to @koba04 and @huozhi for helping!

swr -

Published by shuding over 3 years ago

Minor Changes

  • Types: makes types fn and config and getKey more strictly: #946
  • Fix: do not cache when mutate throws an error synchronously: #977
  • Perf: avoid unnecessary re-renders with the suspense mode: #979
  • Fix: do not depend on navigator.onLine; code optimizations: #1004
  • Fix: sync mutations are applied independently: #1003
  • Fix: sync cache only on compare returns true: #907
  • Optimize isValidating status: #967
  • Clean up types: #1016
  • Enable typescript strict mode: #1010

Patches

  • Update README.md: #974
  • Refactor: move DOM event handlers into web-preset: #972
  • Add-infinite-scroll-example: #970
  • Refactor: add the register prefix to onFocus and onReconnect: #993
  • Add example using useSWRInfinite: #968
  • Test: refactor use-swr-cache.test.tsx: #932
  • Using vite2 and add playground to master: #995
  • Test: refactor use-swr-config-callbacks.test.tsx: #933
  • Keep old esm directory structure: #1011

Credits

Huge thanks to @koba04, @huozhi, @Kexin-Li, @promer94, @dingran, and @ramyareye for helping!

swr -

Published by shuding over 3 years ago

Patches

  • Chore: add comments that revalidate will be deprecated: #937
  • Remove legacy useSWRPages types: #938
  • Test: fix flaky tests for focus and location mutation: #944
  • Refactor: rename from waitForDedupingInterval to waitForNextTick: #960
  • Fix: checking if document is defined: #963

Credits

Huge thanks to @koba04 for helping!

swr -

Published by shuding over 3 years ago

Patches

  • Enhance: let config.isPaused works with react state: #871
  • Fix: add protection for navigator: #877
  • Ci: add GitHub Actions for CI: #879
  • Ci: remove Travis CI: #887
  • Docs: add isPaused() into the options: #888
  • Update default fetcher documentation in README.md: #891
  • Fix: revalidateOnFocus not working on '< iOS 14': #889
  • Refactor: use getter functions to avoid unnecessary re-renders: #890
  • Fix: add server check back for rAF: #899
  • Fix: react-hooks/exhaustive-deps warnings: #886
  • Test: add a test for useSWRInfinite with initialData: #894
  • Separate tests: #901
  • Refactor: fix all react-hooks/exhaustive-deps warnings in tests: #902
  • Docs: use a fake GraphQL endpoint instead of graph.cool: #904
  • Refactor: fix all react-hooks/exhaustive-deps warnings in useSWRInfinite: #905
  • Fix the revalidation condition of the first page: #895
  • Check key before calling callback: #856
  • Chore: format files: #915
  • Chore: rm duplicated tests: #914
  • Test: recognize type definition for screen of testing-library/react: #903
  • Chore: add a comment why fetcher accepts null: #918
  • Refactor: fix all react-hooks/exhaustive-deps warnings in useSWR: #927

Credits

Huge thanks to @huozhi, @koba04, @mcamis, @joshuakimDwan, @joakimgrr, and @promer94 for helping!