Skip to content

Commit bac0ee8

Browse files
authored
Add cache options to getResource/getResourceCollection calls in basic starter page templates (#816)
1 parent a50598c commit bac0ee8

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

starters/basic-starter/app/[...slug]/page.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,19 @@ async function getNode(slug: string[]) {
2727

2828
const type = translatedPath.jsonapi?.resourceName!
2929
const uuid = translatedPath.entity.uuid
30+
const tag = `${translatedPath.entity.type}:${translatedPath.entity.id}`
3031

3132
if (type === "node--article") {
3233
params.include = "field_image,uid"
3334
}
3435

3536
const resource = await drupal.getResource<DrupalNode>(type, uuid, {
3637
params,
38+
next: {
39+
revalidate: 3600,
40+
// Replace `revalidate` with `tags` if using tag based revalidation.
41+
// tags: [tag],
42+
},
3743
})
3844

3945
if (!resource) {

starters/basic-starter/app/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ export default async function Home() {
1717
include: "field_image,uid",
1818
sort: "-created",
1919
},
20+
next: {
21+
revalidate: 3600,
22+
},
2023
}
2124
)
2225

0 commit comments

Comments
 (0)