Skip to content

editor: don't put an empty plugin manager in an empty rail - #741

Merged
Snoopy147 merged 1 commit into
mainfrom
fix/no-empty-plugins-panel
Aug 31, 2026
Merged

editor: don't put an empty plugin manager in an empty rail#741
Snoopy147 merged 1 commit into
mainfrom
fix/no-empty-plugins-panel

Conversation

@Snoopy147

@Snoopy147 Snoopy147 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

What

A visitor who drops into the open lobby (/play/<id>), plays, then presses Esc lands on the read-only canvas — with a bare Plugins panel (heading, one line of copy, a "Create a Pascal plugin" link) eating ~40% of the window over the world they came to play in.

The lobby mounts <Editor isVersionPreviewMode layoutVersion="v2"> under a read-only scene lease and registers no host panels, so the plugin manager — the one tab the editor contributes itself — was alone in the rail. LeftColumn opens on its first tab, so the empty manager opened by default.

How

Two pure functions in lib/plugin-panels.ts:

  • managedPluginIds(panels) — the distinct plugins behind the registered panels (one plugin may contribute several panels; the manager lists plugins).
  • showsPluginManager({managedPluginCount, readOnly, workspaceMode}) — the tab earns its slot when there is a plugin to manage, or when the scene is writable and "Create a Pascal plugin" is still worth offering.

useHostPanels now consults it. The only case dropped is read-only and nothing registered, which is exactly the lobby — and with zero tabs both EditorLayoutV2 and EditorLayoutMobile already skip the sidebar entirely (sidebarTabs.length > 0), so the lobby becomes canvas and nothing else.

What does not change

  • Writable edit workspace: identical for every plugin count, fenced by a regression test.
  • Read-only editor with plugins registered: keeps the tab. Browsing what a project uses is a read; the Install button was already disabled={readOnly}.
  • Studio workspace: unchanged (already excluded).

Verification

  • bun test src in packages/editor807 pass / 0 fail, 10357 assertions (8 of them new, in plugin-panels.test.ts).
  • bun run check-types at the repo root — 11/11 tasks successful.
  • biome check — 1953 files, clean.

🤖 Generated with Claude Code

The open lobby (`/play/<id>`) mounts the editor under a read-only lease and
registers no host panels, so the plugin *manager* was the only tab in the
rail — and the rail opens on its first tab. A visitor who left the game found a
bare "Plugins" heading covering ~40% of the window over the world they had come
to play in.

Gate the manager on having something to manage, or on a writable scene:

- `managedPluginIds(panels)` — the distinct plugins behind the registered
  panels, since one plugin may contribute several and the manager lists plugins.
- `showsPluginManager({managedPluginCount, readOnly, workspaceMode})` — the tab
  earns its slot when a plugin is registered, or when the scene is writable and
  "Create a Pascal plugin" is still worth offering.

The only case this drops is read-only *and* nothing registered, which is exactly
the lobby; with no tabs at all both the v2 and mobile layouts already skip the
sidebar entirely, leaving the canvas alone. A read-only editor keeps the tab as
soon as a plugin is registered — browsing what a project uses is a read, and the
install button was already disabled on its own. Writable edit-workspace
behaviour is unchanged, and fenced by a test that says so.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Snoopy147
Snoopy147 merged commit c712f57 into main Aug 31, 2026
3 checks passed
@Snoopy147
Snoopy147 deleted the fix/no-empty-plugins-panel branch August 31, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant