feat(next): export Versions diff surface as @payloadcms/next/views/diff#16498
Draft
tsemachh wants to merge 2 commits intopayloadcms:mainfrom
Draft
feat(next): export Versions diff surface as @payloadcms/next/views/diff#16498tsemachh wants to merge 2 commits intopayloadcms:mainfrom
@payloadcms/next/views/diff#16498tsemachh wants to merge 2 commits intopayloadcms:mainfrom
Conversation
Adds a public, additive subpath export so plugin and integrator code can build custom diff UIs (e.g. "review changes" drawers) without vendoring or deep-importing internal modules. The new entry exposes: - RenderDiff - buildVersionFields (+ BuildVersionFieldsArgs) - RenderVersionFieldsToDiff (client component) - DiffCollapser (client component) - diffComponents (also re-exported as defaultDiffComponents) - countChangedFields, countChangedFieldsInRows - fieldHasChanges, getFieldsForRowComparison 100% additive: no existing imports change, no behavior change. Closes payloadcms#16496 Co-authored-by: Junie <junie@jetbrains.com>
This was referenced May 6, 2026
Co-authored-by: Junie <junie@jetbrains.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.
Closes #16496
Summary
Adds a public, additive subpath export
@payloadcms/next/views/diffthat re-exports the field-by-field diff rendering surface today living privately underpackages/next/src/views/Version/RenderFieldsToDiff/.This lets plugin and integrator code build "review changes" / custom diff UIs (drawers, dashboards, notifications, PR-bot integrations, etc.) without forking or vendoring Payload's diff components or deep-importing from
@payloadcms/next/dist/....Public surface
Changes
packages/next/src/exports/views/diff.ts— pure re-export entry, no logic.packages/next/package.json— adds"./views/diff"entry to bothexportsandpublishConfig.exports, mirroring the shape of the existing"./views"entry.Why not also point
Version/index.tsxat the new public path?The original plan considered making the internal Versions view import from
@payloadcms/next/views/diff(or the relativeexports/views/diff.js) so external and internal usage shared one source of truth. The repository'spayload/no-imports-from-exports-dirlint rule explicitly forbids that pattern. The single-source-of-truth guarantee still holds because the new entry file is a pure re-export of the same internal modulesVersion/index.tsxconsumes — there is no second copy of any symbol.Backward compatibility
Version/index.tsxis not modified — it continues to import from./RenderFieldsToDiff/index.jsas before.dist/.payload,@payloadcms/translations, or any other package.Tests
This PR is a pure re-export with no new behavior. The existing
test/versions/suite already exercises every symbol exposed here through the built-in Versions view. No new test was added.If maintainers prefer a smoke test asserting the subpath resolves and exposes the listed names, happy to add one in
test/_community/exports.test.ts(or a similar location) — let me know.Concrete consumer
A planned
@shefing/review-buttonplugin will use this surface to render a per-document diff in a side drawer. Without this PR, the plugin would have to vendorRenderFieldsToDiff/and re-vendor on every Payload release.Companion proposal
A separate issue (#16497) and forthcoming PR add a plugin-friendly
config.admin.serverFunctionsregistry so plugins built on top of this export can wire themselves in without forcing integrators to edit(payload)/layout.tsx. This PR stands alone and does not depend on it.