@rest-hooks/react@8.2.0
·
1253 commits
to master
since this release
Release announcement and upgrade guide
Minor Changes
-
5cedd44: Add controller.fetchIfStale()
Fetches only if endpoint is considered 'stale'; otherwise returns undefined.
This can be useful when prefetching data, as it avoids overfetching fresh data.
An example with a fetch-as-you-render router:
{ name: 'IssueList', component: lazyPage('IssuesPage'), title: 'issue list', resolveData: async ( controller: Controller, { owner, repo }: { owner: string; repo: string }, searchParams: URLSearchParams, ) => { const q = searchParams?.get('q') || 'is:issue is:open'; await controller.fetchIfStale(IssueResource.search, { owner, repo, q, }); }, },
Patch Changes
- Updated dependencies [5cedd44]
- @data-client/react@0.4.0