feat: payload version item in admin settings menu#16514
Draft
feat: payload version item in admin settings menu#16514
Conversation
…em injection Server-only components must be referenced via the /rsc subpath, matching the existing pattern in injectHierarchyButton.ts. The bare @payloadcms/ui entry resolves to the client bundle, where PayloadVersionMenuItem is not exported, causing 'getFromImportMap: PayloadComponent not found' at runtime.
Contributor
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖
Largest pathsThese visualization shows top 20 largest paths in the bundle.Meta file: packages/next/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js
Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js
DetailsNext to the size is how much the size has increased or decreased compared with the base branch of this PR.
|
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.
Overview
Adds a "Payload v{version}" item to the admin settings menu (gear icon dropdown) on every Payload app. Clicking it opens a modal listing all installed Payload-related package versions with a copy button matching the
payload infoCLI format. Installs are opt-out viaadmin.versionInSettingsMenu: false.Settings Menu

Modal
Key Changes
New
Admin.versionInSettingsMenuopt-out flag andSanitizedAdmin.packageVersionsmapversionInSettingsMenu?: boolean(defaults to true) on the user-facingAdmintype.packageVersions: Record<string, string>required on the sanitized admin shape, populated once at config sanitization. Named to avoid colliding with the existingAdmin.dependencies(AdminDependencies, used by the import-map).Auto-injection in
sanitizeConfigsanitizeDependencies()once at boot, scanning the user's project forPAYLOAD_PACKAGE_LISTentries via the existinggetDependenciesutility. Falls back to a payload-only map if the scan throws.'@payloadcms/ui/rsc#PayloadVersionMenuItem'as the last entry inadmin.components.settingsMenuunless the user opts out. The/rscsubpath matches the convention used byinjectHierarchyButton.tsfor server-only built-ins.@payloadcms/next/utilities,@payloadcms/ui/shared) are stripped before display so the modal shows bare package names.New
PayloadVersionMenuItemserver component in@payloadcms/uipayload.config.admin.packageVersionsand forwards a serializable copy to a client trigger.PopupList.ButtonwithPayload v{version}, plus aModal(slugpayload-version-info) containing a<dl>of versions withpayloadpinned first, and the existingCopyToClipboardicon-button inline in the header.--bg-default-default,--text-default-secondary,--spacer-N,--radius-medium,--font-family-mono).Tests
sanitizeDependencies(always-payload, alphabetical sort, fallback on throw).packageVersions.payloadpopulation.formatForClipboardunit tests (payload-first ordering, empty-input handling).Design Decisions
settingsMenuslot rather than introducing a new footer slot. The settings menu is the existing surface for admin-level utilities and already supports custom items; adding a new slot would expand the public component-config surface for a single built-in./rscsubpath. Bare@payloadcms/uiresolves to the client bundle (perpackage.json#exports['.']), where server-only components aren't exported. The/rscsubpath is the established convention for built-ins that auto-inject a server component into a config slot.general:payloadVersionInfowould require populating it in every supported language or runningtranslateNewKeysagainst an OpenAI key. Punted as a follow-up;general:copy(already present) is the only translation key consumed.dependencies→packageVersions. Caught during implementation:Config['admin'].dependenciesalready exists for the import-map. Two same-named properties on the same object would clobber at runtime.Overall Flow
sequenceDiagram participant User participant Admin as Admin UI participant Server as Settings Menu (RSC) participant Modal as Version Modal (client) participant Clipboard Note over Server: At boot, sanitizeConfig populates<br/>admin.packageVersions and<br/>appends version item to settingsMenu User->>Admin: Click gear icon Admin->>Server: Render settings menu items Server->>Modal: Pass packageVersions as serializable props User->>Modal: Click "Payload v{version}" Modal-->>User: Open with version list User->>Modal: Click copy Modal->>Clipboard: writeText(formatForClipboard)