vercel/swr
### [`v1.1.1`](https://togithub.com/vercel/swr/releases/1.1.1)
[Compare Source](https://togithub.com/vercel/swr/compare/1.1.0...1.1.1)
#### Highlights of This Release
##### Dynamic `refreshInterval`
You can now pass a function as `refreshInterval`, to dynamically return the interval (in millisecond) til the next request, based on the current data:
```typescript
useSWR('key', fetcher, {
refreshInterval: function (data: Data | undefined) {
if (!data) return 3000 // Initial request
return data.next_update
}
})
```
If return `0`, polling will be stopped.
#### What's Changed
- feat: refreshInterval as a function by [@Andrewnt219](https://togithub.com/Andrewnt219) in [https://github.com/vercel/swr/pull/1690](https://togithub.com/vercel/swr/pull/1690)
- test: add refreshInterval function returns 0 by [@Andrewnt219](https://togithub.com/Andrewnt219) in [https://github.com/vercel/swr/pull/1691](https://togithub.com/vercel/swr/pull/1691)
- fix: If `newData` is deeply to the latest state, broadcast the latest state by [@icyJoseph](https://togithub.com/icyJoseph) in [https://github.com/vercel/swr/pull/1697](https://togithub.com/vercel/swr/pull/1697)
- fix: Return `undefined` data if key's falsy under suspense mode by [@icyJoseph](https://togithub.com/icyJoseph) in [https://github.com/vercel/swr/pull/1698](https://togithub.com/vercel/swr/pull/1698)
#### New Contributors
- [@Andrewnt219](https://togithub.com/Andrewnt219) made their first contribution in [https://github.com/vercel/swr/pull/1690](https://togithub.com/vercel/swr/pull/1690)
- [@icyJoseph](https://togithub.com/icyJoseph) made their first contribution in [https://github.com/vercel/swr/pull/1697](https://togithub.com/vercel/swr/pull/1697)
**Full Changelog**: https://github.com/vercel/swr/compare/1.1.0...1.1.1
Configuration
📅 Schedule: At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, click this checkbox.
This PR contains the following updates:
1.1.0
->1.1.1
Release Notes
vercel/swr
### [`v1.1.1`](https://togithub.com/vercel/swr/releases/1.1.1) [Compare Source](https://togithub.com/vercel/swr/compare/1.1.0...1.1.1) #### Highlights of This Release ##### Dynamic `refreshInterval` You can now pass a function as `refreshInterval`, to dynamically return the interval (in millisecond) til the next request, based on the current data: ```typescript useSWR('key', fetcher, { refreshInterval: function (data: Data | undefined) { if (!data) return 3000 // Initial request return data.next_update } }) ``` If return `0`, polling will be stopped. #### What's Changed - feat: refreshInterval as a function by [@Andrewnt219](https://togithub.com/Andrewnt219) in [https://github.com/vercel/swr/pull/1690](https://togithub.com/vercel/swr/pull/1690) - test: add refreshInterval function returns 0 by [@Andrewnt219](https://togithub.com/Andrewnt219) in [https://github.com/vercel/swr/pull/1691](https://togithub.com/vercel/swr/pull/1691) - fix: If `newData` is deeply to the latest state, broadcast the latest state by [@icyJoseph](https://togithub.com/icyJoseph) in [https://github.com/vercel/swr/pull/1697](https://togithub.com/vercel/swr/pull/1697) - fix: Return `undefined` data if key's falsy under suspense mode by [@icyJoseph](https://togithub.com/icyJoseph) in [https://github.com/vercel/swr/pull/1698](https://togithub.com/vercel/swr/pull/1698) #### New Contributors - [@Andrewnt219](https://togithub.com/Andrewnt219) made their first contribution in [https://github.com/vercel/swr/pull/1690](https://togithub.com/vercel/swr/pull/1690) - [@icyJoseph](https://togithub.com/icyJoseph) made their first contribution in [https://github.com/vercel/swr/pull/1697](https://togithub.com/vercel/swr/pull/1697) **Full Changelog**: https://github.com/vercel/swr/compare/1.1.0...1.1.1Configuration
📅 Schedule: At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by WhiteSource Renovate. View repository job log here.