Repository navigation
feat(admin): allow trusted plugins to add content list columns - #2195
Conversation
🦋 Changeset detectedLatest commit: de74ca6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 17 packages
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 |
Scope checkThis PR changes 586 lines across 10 files. Large PRs are harder to review and more likely to be closed without review. If this scope is intentional, no action needed. A maintainer will review it. If not, please consider splitting this into smaller PRs. See CONTRIBUTING.md for contribution guidelines. |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-verification
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
There was a problem hiding this comment.
This is a focused, well-scoped addition to the trusted-plugin admin surface. It solves the right problem (display-only content-list columns contributed by trusted React plugins) in the right way: EmDash keeps ownership of the table while plugins provide header/cell components;filtering, sorting, and search are deliberately left out because they need server-backed semantics. The change follows the same trusted-plugin model already used for pages, widgets, and field widgets, and it is backed by an approved Discussion (#2048).
I checked the new resolver, the boundary component, the ContentList integration, the router wiring, the test coverage, and the changeset. The logic is sound: disabled/stale plugins are omitted, role and collection filters work, malformed/duplicate definitions are isolated, and error boundaries keep a broken column from crashing the list. No logic bugs, security issues, regressions, or logged-out query-count impacts were found.
There are three AGENTS.md import-extension violations on changed/new lines: two new internal imports omit the required .js extension. Fixing those is the only blocker.
Overlapping PRsThis PR modifies files that are also changed by other open PRs:
This may cause merge conflicts or duplicated work. A maintainer will coordinate. |
ee1f044 to
0a83f6d
Compare
0a83f6d to
8825b20
Compare
8825b20 to
ffe1365
Compare
ffe1365 to
139939b
Compare
86099f1 to
acc1ed3
Compare
5760ef3 to
183cae3
Compare
There was a problem hiding this comment.
Re-review of the trusted-plugin content-list column extension. The overall approach remains sound: EmDash keeps ownership of the table, pagination, row actions, loading/empty states, and sort/filter/search contracts, while letting trusted React plugins contribute display-only columns through the existing manifest-driven plugin admin module. This fits the plugin architecture without leaking host responsibilities.
I re-read the full diff, the new resolver, the boundary component, the ContentList integration, the tests, the docs, and the changeset. The extension correctly filters disabled/stale plugins, applies role and collection visibility, validates malformed definitions, deduplicates per-plugin IDs, orders deterministically, keeps plugin columns out of Trash, and uses Lingui-wrapped strings with RTL-safe logical Tailwind.
One regression surfaced: the ContentListColumnBoundary key around each plugin cell includes item.updatedAt, which forces every plugin cell to unmount and remount whenever an item’s updatedAt changes (polls, mutations, autosaves, etc.). This contradicts the documented contract that “every cell component mounts once per visible row” and destroys local React state/effects inside trusted plugin cells. The boundary should key on stable row identity (collection, item locale, id, plugin, and column id) and reset its error state via lifecycle logic if data-change reset is truly needed.
No security issues, locale-filter misses, broken API-envelope contracts, or AGENTS.md convention violations were found outside the single issue above.
bc8cdd8 to
cbe8815
Compare
cbe8815 to
11c2f3a
Compare
There was a problem hiding this comment.
Re-review of PR #2195 — trusted-plugin content-list columns.
The previous review flagged a concrete regression: the ContentListColumnBoundary around each plugin cell was keyed on item.updatedAt, which forced every trusted-plugin cell to unmount/remount on any row update (polls, autosaves, mutations) and destroyed local state/effects inside the plugin cell. That contradicted the documented contract that cells mount once per visible row.
That issue is fixed in this revision:
- The cell boundary now keys on stable row identity:
${collection}:${item.locale}:${item.id}:${pluginId}:${extension.id}. - Data-driven retry is handled via a
resetKey={item.updatedAt}prop andcomponentDidUpdatelifecycle logic insideContentListColumnBoundary, which clearshasErroronly when the row actually changes. - A regression test (
preserves contributed cell state when an existing row updates) asserts the cell does not remount whenupdatedAtchanges, and a companion test verifies that error recovery still happens on row update.
I re-read the resolver in packages/admin/src/lib/content-list-columns.tsx, the ContentList integration, the router.tsx wiring, the virtual-module type update, the changeset, and the docs. The extension still filters disabled/stale plugins, applies collection and role visibility, validates malformed definitions, deduplicates per-plugin IDs, orders deterministically, keeps plugin columns out of Trash, and uses Lingui-wrapped strings with RTL-safe logical Tailwind.
No remaining blocking issues, AGENTS.md violations, or security/locale/API-envelope concerns were found. Approving.
There was a problem hiding this comment.
This PR is the right change for the approved Discussion: it fits the existing trusted-plugin extension pattern, keeps EmDash in control of the table/pagination/actions, and is well scoped to display-only columns. The previous review's regression is fixed — the cell boundary now keys on stable row identity (collection:locale:id:pluginId:columnId) and uses a separate resetKey={item.updatedAt} for data-driven retry, so plugin cells mount once per visible row.
I re-read the resolver, the ContentList integration, the router wiring, the virtual-module type update, the changeset, and the tests. The implementation otherwise follows the conventions I checked: Lingui-wrapped strings, RTL-safe logical Tailwind (text-start/text-end), deterministic plugin ordering, manifest/role/collection filtering, Trash exclusion, and a changeset covering both touched packages. No logged-out routes are affected.
One new needs_fixing issue: the runtime validator for cell and header uses typeof === "function", which silently rejects valid React components created with React.forwardRef or React.memo. Those return objects at runtime, even though the TypeScript React.ComponentType type accepts them. This breaks the documented contract for plugin authors. The fix is to use React.isValidElementType (excluding strings) and add a regression test with a forwardRef cell/header.
With that validation fixed and a test added, this looks ready to approve.
There was a problem hiding this comment.
The PR addresses the approved Discussion: it keeps EmDash in control of the content-list table, pagination, and row actions while letting trusted React plugins contribute display-only columns. The scope is focused, the resolver isolates misbehaving plugins, and the integration respects existing localization and RTL conventions.
I re-read the resolver, the ContentList integration, the router wiring, the virtual-module type update, the docs, the changeset, and the tests. The previously flagged regression is fixed: the component validator now accepts forwardRef and memo cells/headers (via $$typeof wrapper-type checks and a typeof === "function" fallback), and a regression test covers it. I also checked for the conventions in AGENTS.md: Lingui-wrapped strings, RTL-safe logical Tailwind, deterministic ordering, manifest/role/collection filtering, Trash exclusion, changeset coverage, and no logged-out route impact. No issues remain.
Approved.
What does this PR do?
Adds a focused, display-only content-list column extension for trusted React plugins.
Plugins can export typed
contentListColumnsdefinitions for computed metadata such as review statuses, moderation outcomes, or publication readiness. EmDash retains ownership of the table, pagination, row actions, loading states, and empty states while passing each cell the current content item, collection, and locale.The resolver:
Sorting, filtering, and search remain outside this display-only contract because they require server-backed contracts. Search is covered by #2191, indexed sorting by #2212, and indexed filtering by #2213.
#2194 has merged and supplies the shared content-list layout. This branch is now based on
mainand contains only the trusted-plugin extension commits.Approved Discussion: #2048
Wider content-list context: #2397
Closes: N/A
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runmessages.pochanges except in translation PRs; a workflow extracts catalogs on merge tomain.AI-generated code disclosure
Screenshots / test output
Local validation after rebasing:
git diff --checkNo screenshot is included because the extension renders only when a trusted plugin contributes a column.