Skip to content

[Feature Request] Propagate fetchOptions to all internal API requests and reference resolutions #222

@CaarLo1337

Description

@CaarLo1337

Hello,
we’ve noticed that the fetchOptions provided to API methods like fetchByFilter are currently only applied to the initial fetch call and are not propagated to any subsequent or internal requests.

const contentAreas = await remoteApi.fetchByFilter({
  filters: [
    {
      field: "fsType",
      operator: ComparisonQueryOperatorEnum.EQUALS,
      value: "GCAPage",
    },
  ],
  fetchOptions: getCacheOption("cmsGlobalContentAreas") as RequestInit,
  locale: input.lang,
});

In this case, we use a Next.js cache strategy via fetchOptions:
{ next: { revalidate: 300 } }

However, this setting only affects the first fetch. Any internal requests – such as those for resolving references – do not inherit these fetchOptions.

Feature Request:
It would be highly beneficial if the provided fetchOptions were automatically applied to all nested or recursive internal API calls. This would ensure consistent handling of caching strategies throughout the full API request chain.

https://nextjs.org/docs/app/api-reference/functions/fetch

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions