Repository navigation
Support Next.js 16 in next/server and move next-app to it - #12
Merged
Merged
Conversation
examples/published-next-app now locks mutaflow and @mutaflow/devtools 0.2.0 from npm, and a new CI job installs, typechecks and builds it without the workspace, so the install path of the latest release is checked on every change. Each package's build removes dist first, so files from an older build of another branch cannot end up in a published tarball. The root clean script uses Node instead of PowerShell. npm audit fix (no major upgrades) updates jsdom's undici and source-map-js at the root and next 15.5.29, nanoid and sharp in the examples. postcss inside Next 15 still needs Next 16. RELEASING.md notes how to check npm ownership before publishing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Next.js 16 requires the profile argument of revalidateTag and
deprecates calls without it. With 0.2.0, passing its revalidateTag to
withFlowContract was a type error, and every call logged a warning.
NextCacheBindings.revalidateTag now takes a NextRevalidateTagProfile,
so the functions of both Next.js 15 and 16 fit. A profile is always
passed: "max" for stale-while-revalidate, { expire: 0 } otherwise
(expire now, as before); Next.js 15 ignores it. revalidateProfile in
the options overrides it.
examples/next-app moves to Next.js 16 and passes updateTag, so
consistency.immediate uses it; npm audit is clean there.
examples/published-next-app stays on Next.js 15 until a release with
this fix is on npm.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mutaflow@0.2.0does not work cleanly with Next.js 16. Next.js 16 requires the second argument ofrevalidateTag(acacheLifeprofile) and deprecates calls without it:revalidateTagtowithFlowContractorcreateNextServerHelpersis a type error;"revalidateTag" without the second argument is now deprecated, because mutaflow passed no profile unless the strategy was stale-while-revalidate.This PR fixes
mutaflow/next/serverand movesexamples/next-appto Next.js 16.Library (
packages/mutaflow/src/next/server/index.ts):NextCacheBindings.revalidateTagtakesprofile: NextRevalidateTagProfile(string | { expire?: number }), so therevalidateTagof both Next.js 15 and Next.js 16 fits.A profile is always passed:
"max"for stale-while-revalidate, as before;{ expire: 0 }otherwise. That expires the tag now, which is what the one-argument call did.Next.js 15's
revalidateTag(tag)ignores the extra argument; I checked the 15.5.29 source.A new
revalidateProfileoption inwithFlowContractandapplyNextInvalidationsoverrides the profile.NextRevalidateTagProfileis exported frommutaflow/next/server.Examples:
examples/next-appmoves tonext ^16.5.0and passesupdateTag, soconsistency.immediateuses it for read-your-own-writes.tsconfig.jsonandnext-env.d.tscontain the edits Next.js 16 makes itself.npm auditthere reports 0, which clears thepostcssfindings left in Build the published example in CI and clean dist before builds #11.onAppliedlogs which tags were updated and which were revalidated.examples/published-next-appstays on Next.js 15. It installsmutaflow@0.2.0from npm, which has the type error above, so its CI job would fail on Next.js 16. Its README says why. It can move once a release with this fix is published.updateTagexists from Next.js 16, andCHANGELOG.mdgets anUnreleasedsection.This branch is based on #11. Merge #11 first; after that, the diff here contains only commit
7c08111.Test plan
revalidateTagshaped like Next.js 16 (it throws without a profile). It covers the stale-while-revalidate, immediate-without-updateTagandrevalidateProfilecases.tests/types/next-cache.ts: the Next.js 15 and 16next/cachesignatures fitNextCacheBindings, and a narrowerrevalidateTagdoes not.npm run typecheckandnpm testpass (63 tests, plus 5node:testtests);examples/next-app(Next.js 16.5) andexamples/published-next-app(Next.js 15.5) passnpm ci,typecheckandnext build.next-apptypechecks with no.nextfolder, as in CI.next startwith Next.js 16:updatedTagsand nothing underrevalidatedTags;🤖 Generated with Claude Code