Repository navigation
fix(admin): hide collections marked hidden from the dashboard Content card - #4096
Conversation
… card "Hide from navigation" removes a collection's sidebar entry, command palette link and dashboard quick action so that a plugin which owns the collection can keep editors out of it. The dashboard's Content card still listed every hidden collection with a link into it, so the dashboard kept steering editors where the sidebar does not. The card now skips collections whose manifest entry is hidden, the same check the quick actions make. Collections missing from the manifest still render, and hidden collections still count toward the dashboard totals and still appear in Recent Activity. The docs, type comments and the toggle's help text now name the Content card alongside the other three surfaces.
🦋 Changeset detectedLatest commit: cb3c743 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 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 |
There was a problem hiding this comment.
This PR fixes the right bug in the right place. The dashboard Content card was the remaining navigation surface that ignored hidden: true; filtering its rows client-side by the same manifest flag used by the sidebar, quick actions, and command palette makes the behavior consistent without touching the server-side stats. The counts still include hidden collections, Recent Activity still lists them, and direct URLs/API/plugins still work — exactly what the description promises.
What I checked:
- Read the diff and the full
Dashboard.tsx,Dashboard.test.tsx,ContentTypeEditor.tsx, and the changed docs/type files. - Verified the new
visibleCollectionsfilter logic:!manifest.collections[col.slug]?.hiddencorrectly keeps manifest-visible collections and collections not in the manifest, and hides only collections explicitly markedhidden: true. - Confirmed
Sidebar.tsxandAdminCommandPalette.tsxalready use the samevisibleCollectionEntrieshelper, so the Content card change finally aligns the last surface with the existing pattern. - Confirmed
SummaryMetricsandRecentActivitystill operate on the fullstats.collections/stats.recentItems, preserving totals and recent-item visibility as claimed. - Reviewed the regression test added next to the quick-action test: it renders stats for a hidden
sync_runscollection and asserts both the accessible link and the rawhrefare absent. It exercises observable UI behavior and would fail onmain. - Checked the changeset against
.changeset/README.md: it leads with "Fixes", names the user-facing surface, describes the observable problem, and notes the preserved behavior. The single@emdash-cms/adminpatch is correct — the core changes are type-comment/docs-only updates with no runtime/API impact. - Checked AGENTS.md conventions: user-facing strings are Lingui-wrapped, no new directional Tailwind classes, no SQL, no new logged-out queries, no stale comments added.
I found nothing that needs fixing. The implementation is minimal, consistent with existing code, covered by a regression test, and accurately documented.
@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-test
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-loader
@emdash-cms/registry-moderation
@emdash-cms/registry-verification
upgrade-emdash
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-ai-search
@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: |
What does this PR do?
Hide from navigation (
hidden: true) removes a collection's sidebar entry, command palette link and dashboard quick action so that a plugin which manages the collection end to end can keep editors out of it (#3440, #3060). The dashboard's Content card is built from the same manifest but still listed every hidden collection with a link into it, so the dashboard kept steering editors into collections the sidebar hides.The Content card now skips collections whose manifest entry is
hidden, the same check the quick actions and the sidebar make. Collections that are not in the manifest render as before. Nothing else about hidden collections changes: they still count toward the dashboard's Drafts and Scheduled totals, still appear in Recent Activity, and stay reachable by URL, API and plugins. A site whose every collection is hidden sees the card's existing "No collections configured" line, as the sidebar shows no entries in that case.#3060 left the Content card alone as a server-side stats surface. The counts are, but each row is a link into the collection, which is the navigation the flag is meant to remove; filtering the rows client-side by the manifest leaves the server stats untouched.
Also in this PR: a regression test next to the quick-actions test, a patch changeset, and the docs, type comments and the toggle's help text now name the Content card alongside the other surfaces.
My connection: on my own EmDash 1.2 site, two legacy collections that are hidden from navigation still show up on the dashboard's Content card, and I have been hiding their links with admin CSS until the card respects the flag. Verification: the new test fails on
mainand passes here, and the before/after screenshots below come fromdemos/simplewith the seeded Posts collection hidden.Related: #3060, #3440. No linked issue.
Type of change
Your connection to this 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 assistance disclosure
Screenshots / test output
demos/simpleon this branch's base, with the seeded Posts collection switched to Hide from navigation. The sidebar and the quick actions already leave Posts out; the Content card did not.Full dashboard for context, same state: before · after. The Draft total and Recent Activity still include the hidden Posts in both.
Targeted test run:
pnpm --filter @emdash-cms/admin exec vitest run tests/components/Dashboard.test.tsx— 26 passed, including the newomits hidden collections from the Content card, which fails onmainbecause the Sync runs row is found (expect.element(getByRole("link", { name: /Sync runs/ })).not.toBeInTheDocument()).