Skip to content

@rest-hooks/react@8.2.0

Compare
Choose a tag to compare
@github-actions github-actions released this 13 Aug 05:07
· 588 commits to master since this release
3356138

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