Skip to content

[Fix/197 plugin settings link] fix(admin): correct settings link to plugin root#227

Open
WebDevByCam wants to merge 3 commits intoemdash-cms:mainfrom
WebDevByCam:fix/197-plugin-settings-link
Open

[Fix/197 plugin settings link] fix(admin): correct settings link to plugin root#227
WebDevByCam wants to merge 3 commits intoemdash-cms:mainfrom
WebDevByCam:fix/197-plugin-settings-link

Conversation

@WebDevByCam
Copy link
Copy Markdown

@WebDevByCam WebDevByCam commented Apr 4, 2026

What does this PR do?

Fixes the plugin "Settings" link in the Admin UI so it navigates to the plugin's root page instead of a hard-coded "settings" path. This makes plugin settings navigation work for plugins that expose root pages or nested pages, and avoids broken routes when the plugin's page structure differs from the previous assumption.

Closes #197

Type of change

  • [ x ] Bug fix
  • Feature (requires approved Discussion)
  • Refactor (no behavior change)
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • [ x ] I have read CONTRIBUTING.md
  • [ x ] pnpm typecheck passes
  • pnpm --silent lint:json | jq '.diagnostics | length' returns 0
  • pnpm test passes (or targeted tests for my change)
  • [ x ] pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • [ x ] I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion: https://github.com/emdash-cms/emdash/discussions/...

Copilot AI review requested due to automatic review settings April 4, 2026 07:51
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 4, 2026

🦋 Changeset detected

Latest commit: 299a504

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@emdash-cms/admin Patch
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/plugin-ai-moderation Patch
@emdash-cms/plugin-atproto Patch
@emdash-cms/plugin-audit-log Patch
@emdash-cms/plugin-color Patch
@emdash-cms/plugin-embeds Patch
@emdash-cms/plugin-forms Patch
@emdash-cms/plugin-webhook-notifier Patch

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

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the Admin UI “Settings” link for plugins so it no longer navigates to a hard-coded /settings subpath (addressing #197), aiming to support plugins whose primary admin page is the root or another path.

Changes:

  • Update the plugin “Settings” button navigation target in the plugin manager UI.
  • Add a changeset for a patch release of @emdash-cms/admin.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/admin/src/components/PluginManager.tsx Changes the Settings link destination for plugin admin pages.
.changeset/fix-plugin-settings-link.md Adds a patch changeset describing the navigation fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 374 to 378
{plugin.hasAdminPages && plugin.enabled && (
<Link to="/plugins/$pluginId/$" params={{ pluginId: plugin.id, _splat: "settings" }}>
<Link to="/plugins/$pluginId/$" params={{ pluginId: plugin.id, _splat: "" }}>
<Button variant="ghost" shape="square" aria-label="Settings">
<Gear className="h-4 w-4" />
<span className="sr-only">Settings</span>
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting _splat to an empty string forces navigation to the plugin pagePath "/". Many plugins only expose admin pages at non-root paths (e.g. "/settings", "/status"), so this change will make the Settings button land on an empty/404 plugin page for those plugins (regression from the previous behavior).

Instead of hard-coding "settings" or "", derive the destination from the plugin’s declared adminPages in the manifest (e.g. first page), and convert that path into the router’s _splat form (strip the leading "/"; use empty/undefined for "/"). Also consider updating the aria-label/sr-only text to match the actual destination (page label or a generic "Open plugin").

Copilot uses AI. Check for mistakes.
Comment on lines 374 to 376
{plugin.hasAdminPages && plugin.enabled && (
<Link to="/plugins/$pluginId/$" params={{ pluginId: plugin.id, _splat: "settings" }}>
<Link to="/plugins/$pluginId/$" params={{ pluginId: plugin.id, _splat: "" }}>
<Button variant="ghost" shape="square" aria-label="Settings">
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are existing PluginManager tests, but they only assert the Settings button exists and the mocked Link ignores params, so this navigation change isn’t covered. Please add/update tests to verify the Settings link targets the correct plugin admin page path (at least cases for adminPages root "/" vs "/settings" vs a nested path).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Settings icon for forms plugin links to wrong page

2 participants