Skip to content

useFetch fetchPolicy #26017

@Akryum

Description

@Akryum

Describe the feature

Give more control over caching with fetching strategies/policies:

useFetch('/api/foo', {
  fetchPolicy: 'cache-first',
})
  • cache-first: if present in cache, return without requesting, otherwise request then update the cache.
  • cache-and-network : if present in cache, return. In any case, request in the background then update the cache.
  • network-only: request and wait response to return, then update the cache.
  • cache-only: only return from cache, don't request.
  • no-cache: request and wait response to return, don't update the cache.
  • standby: same as cache-first but don't refresh if path/parameter changes.

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions