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

Add Cache (Tags/Revalidate) opions to getResource/getResourceCollection Calls in Basic Starter Page Templates #808

Open
backlineint opened this issue Oct 22, 2024 · 0 comments
Labels
enhancement New feature or request triage A new issue that needs triage

Comments

@backlineint
Copy link
Contributor

Package

basic-starter

Describe the feature request

#784 introduced revalidate options for the fetch methods used by the Next Drupal client, including tags. But currently the page templates in our starters don't use them when making fetch requests.

Describe the solution you'd like

A little bit on the fence here, but it seems like the revalidation option might be the best starting point, with tags being an option that is easy to enable.

  • In app/slug/page.tsx:
    ** Create a new const tag based on the data returned from translatePath. The value should be of the type entity.type:entity.id
    ** In the options for getResource, pass a next object with:
    *** Revalidate set to some default value (3600?)
    *** Tags set to the value of the tag const. This should be commented out by default.

  • In app/page.tsx:
    ** In the options for getResourceCollection, pass a next object with:
    *** Revalidate set to some default value (3600?)
    Note: it isn't clear to me how to efficiently use tags to invalidate this articles list. We won't know the individual node ids until we get the response back, and the only grouped tag I see from jsonapi is 'node_list' which seems to broad. As a result, invalidation only seems like the best place to start.

Describe alternatives you've considered

Defaulting to tags instead of revalidate/paths. Could make this change if we hear positive feedback related to the new tag based revalidation features.

@backlineint backlineint added enhancement New feature or request triage A new issue that needs triage labels Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage A new issue that needs triage
Projects
None yet
Development

No branches or pull requests

1 participant