Skip to content

Add support for swr with revalidateTag#1122

Merged
conico974 merged 27 commits intomainfrom
conico/swr-tag
Apr 8, 2026
Merged

Add support for swr with revalidateTag#1122
conico974 merged 27 commits intomainfrom
conico/swr-tag

Conversation

@conico974
Copy link
Copy Markdown
Contributor

@conico974 conico974 commented Mar 15, 2026

Add support for swr with revalidateTag.

It introduces a new methods in the tag cache (hasBeenStale, optional), both for the original and the next mode tag cache.

It also introduces a RequestCache utils that can be used to cache things scoped to a request (stored in our internal AsyncLocalStorage context)

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 15, 2026

🦋 Changeset detected

Latest commit: 185e81a

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

This PR includes changesets to release 2 packages
Name Type
@opennextjs/aws Minor
app-pages-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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Mar 15, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@opennextjs/aws@1122

commit: d23a850

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 22, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 35.83% 3943 / 11004
🔵 Statements 35.83% 3943 / 11004
🔵 Functions 57.79% 189 / 327
🔵 Branches 78.85% 1048 / 1329
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/open-next/src/adapters/cache.ts 88.42% 87.74% 100% 88.42% 28-29, 93-101, 196, 215-216, 432, 452-473, 507-508, 542-551, 561-569
packages/open-next/src/adapters/composable-cache.ts 96.25% 91.04% 100% 96.25% 43, 52, 62, 71, 221, 234-235
packages/open-next/src/adapters/dynamo-provider.ts 0% 0% 0% 0% 1-98
packages/open-next/src/build/compileCache.ts 0% 0% 0% 0% 1-77
packages/open-next/src/build/helper.ts 17.69% 87.5% 8.69% 17.69% 21-66, 77-110, 113-194, 215-233, 244-250, 261-270, 273-279, 282-283, 287-298, 331-332, 357-378, 381-393, 396-410, 447-455, 458-459, 462-463, 474-495, 498-499, 510-528
packages/open-next/src/build/patch/patches/patchNextServer.ts 100% 100% 100% 100%
packages/open-next/src/overrides/tagCache/dummy.ts 0% 100% 100% 0% 4-24
packages/open-next/src/overrides/tagCache/dynamodb-lite.ts 96.79% 79.79% 100% 96.79% 151-152, 198-201, 271-274
packages/open-next/src/overrides/tagCache/dynamodb-nextMode.ts 100% 87.05% 100% 100%
packages/open-next/src/overrides/tagCache/dynamodb.ts 99.18% 83.13% 100% 99.18% 267-268
packages/open-next/src/overrides/tagCache/fs-dev-nextMode.ts 0% 0% 0% 0% 1-92
packages/open-next/src/overrides/tagCache/fs-dev.ts 0% 0% 0% 0% 1-100
packages/open-next/src/types/cache.ts 0% 0% 0% 0%
packages/open-next/src/types/global.ts 0% 0% 0% 0%
packages/open-next/src/types/overrides.ts 0% 0% 0% 0%
packages/open-next/src/utils/cache.ts 82.97% 70% 100% 82.97% 28-29, 32, 54-55, 59-60, 62-63, 67, 80-81, 89-90, 116-117
packages/open-next/src/utils/promise.ts 0% 0% 0% 0% 1-141
packages/open-next/src/utils/requestCache.ts 100% 100% 100% 100%
packages/open-next/src/utils/semver.ts 100% 100% 100% 100%
Generated in workflow #1770 for commit 185e81a by the Vitest Coverage Report Action

Copy link
Copy Markdown
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

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

@conico974 I have started to look at the PR and added a few minor comments.

I'll do a second pass early afternoon.

Comment thread .changeset/slick-crabs-hear.md Outdated
Comment thread .changeset/slick-crabs-hear.md Outdated
Comment thread .changeset/slick-crabs-hear.md Outdated
Comment thread packages/open-next/src/types/overrides.ts Outdated
Comment thread packages/open-next/src/utils/cache.ts Outdated
Comment thread packages/open-next/src/overrides/tagCache/fs-dev.ts Outdated
Comment thread packages/open-next/src/types/global.ts Outdated
Comment thread packages/open-next/src/utils/cache.ts Outdated
Comment thread packages/open-next/src/adapters/cache.ts Outdated
Comment thread packages/open-next/src/build/patch/patches/patchNextServer.ts
Copy link
Copy Markdown
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

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

A few more comments and questions

Comment thread packages/open-next/src/types/cache.ts Outdated
Comment thread packages/open-next/src/types/overrides.ts
Comment thread packages/open-next/src/types/overrides.ts
Comment thread packages/open-next/src/utils/cache.ts
Comment thread packages/open-next/src/adapters/cache.ts
Comment thread packages/open-next/src/adapters/cache.ts Outdated
Comment thread packages/open-next/src/adapters/composable-cache.ts Outdated
Comment thread packages/tests-unit/tests/adapters/cache.test.ts Outdated
Copy link
Copy Markdown
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

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

Thanks for the updates @conico974

I have added a few minor comments but LGTM otherwise

Comment thread .changeset/slick-crabs-hear.md Outdated
Comment thread .changeset/slick-crabs-hear.md Outdated
Comment thread packages/open-next/src/adapters/cache.ts
Comment thread packages/open-next/src/adapters/composable-cache.ts
Comment thread packages/open-next/src/adapters/dynamo-provider.ts
Comment thread packages/open-next/src/build/compileCache.ts
Comment thread packages/open-next/src/overrides/tagCache/dummy.ts Outdated
Comment thread packages/open-next/src/types/overrides.ts Outdated
@conico974 conico974 merged commit 1a75cc7 into main Apr 8, 2026
1 of 2 checks passed
@conico974 conico974 deleted the conico/swr-tag branch April 8, 2026 12:12
@github-actions github-actions Bot mentioned this pull request Apr 3, 2026
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.

2 participants