Skip to content

Conversation

sommeeeer
Copy link
Contributor

@sommeeeer sommeeeer commented Aug 28, 2025

This is for #958. Our goal is to make E2E work locally

With this new override revalidateTag and revalidatePath will work out of the box running OpenNext locally. This override can be used to support composable caching when that becomes stable aswell. There will come more PRs to make E2E work locally.

Copy link

changeset-bot bot commented Aug 28, 2025

🦋 Changeset detected

Latest commit: e0bc614

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@opennextjs/aws Patch
app-pages-router Patch
app-router Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

pkg-pr-new bot commented Aug 28, 2025

Open in StackBlitz

pnpm add https://pkg.pr.new/@opennextjs/aws@964

commit: e0bc614

@sommeeeer
Copy link
Contributor Author

Thanks for the review Kheuzy!

@sommeeeer sommeeeer requested a review from khuezy August 28, 2025 21:04
export default {
name: "fs-dev-nextMode",
mode: "nextMode",
getLastRevalidated: async (tagsToCheck: string[]) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar w/ the base spec for tag cache. I see writeTags, shouldn't there be a readTags?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for the new tagCache mode called nextMode. It works a bit different, and also is necessary to make composable cache work when that becomes stable.

hasBeenRevalidated() will check if any tags have been revalidated. You can see it in action here:

if (globalThis.tagCache.mode === "nextMode") {
return await globalThis.tagCache.hasBeenRevalidated(tags, lastModified);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which part of the code reads and load the tags that was written to the file system?

Copy link
Contributor Author

@sommeeeer sommeeeer Aug 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/opennextjs/opennextjs-aws/blob/31c3740/packages/open-next/src/build/createAssets.ts#L253-L269 - the dynamodb-cache.json gets written here during build. In our fs-dev-nextMode override we read that file on top level and put it in a let tags = ....

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Composable cache works with the original tag cache as well. And you don't need the original file

export default {
name: "fs-dev-nextMode",
mode: "nextMode",
getLastRevalidated: async (tagsToCheck: string[]) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Composable cache works with the original tag cache as well. And you don't need the original file

@sommeeeer
Copy link
Contributor Author

Thanks Nico! Was a much better idea to use a Map. This tagCache interface is way easier to use aswell!

@sommeeeer sommeeeer requested review from conico974 and khuezy August 30, 2025 16:20
@conico974 conico974 merged commit 05e911f into opennextjs:main Aug 31, 2025
3 checks passed
@github-actions github-actions bot mentioned this pull request Aug 31, 2025
@sommeeeer sommeeeer deleted the add-fsdev-nextmode branch August 31, 2025 18:06
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.

3 participants