Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fetcher): api updates for 1.0 release #15

Merged
merged 12 commits into from
Mar 22, 2024
Merged

feat(fetcher): api updates for 1.0 release #15

merged 12 commits into from
Mar 22, 2024

Conversation

blurrah
Copy link
Member

@blurrah blurrah commented Mar 18, 2024

General update of the fetcher codebase:

  • No more mixing of async/await and Promise.then()
  • More freedom in error handling on GraphQL body errors using an errorPolicy option
  • Next and cache options for fetch can now be set in an object instead of positional arguments, you no longer need to set the cache option if you want to add next options
  • Disabling the cache no longer sets revalidate to 0, this removes constant error messages in Next.js
  • Renamed disableCache to dangerouslyDisableCache as this should only be used with care
  • Set package version for tracer during build time
  • Add NextFetchConfig to RequestInit to extend fetch() with all the Next.js fields
  • Prefix error messages so it's clear where the errors originate from

Note: This PR contains breaking changes and should only be released with a major release

Breaking changes:

  • initServerFetcher() options disableCache has been renamed to dangerouslyDisableCache
  • Server fetcher params now use a single object for cache and next options instead of positional arguments
  • Server fetcher default fetch cache option has been changed from force-cache to default
  • Server fetcher with dangerouslyDisableCache will now set cache: "no-store" and remove the revalidate key from the next object as to not trigger warnings and errors in Next.js
  • Client fetcher option persisted has been renamed to persistedQueries
  • Client fetcher option onBeforeRequest has been removed, package consumers will have to run their own function before starting the fetch

@blurrah blurrah marked this pull request as ready for review March 20, 2024 09:28
src/client.ts Outdated Show resolved Hide resolved
@blurrah blurrah merged commit 13f885c into main Mar 22, 2024
1 check passed
@blurrah blurrah deleted the api-update branch March 22, 2024 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants