editor: don't put an empty plugin manager in an empty rail - #741
Merged
Conversation
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>
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.
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.LeftColumnopens 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.useHostPanelsnow consults it. The only case dropped is read-only and nothing registered, which is exactly the lobby — and with zero tabs bothEditorLayoutV2andEditorLayoutMobilealready skip the sidebar entirely (sidebarTabs.length > 0), so the lobby becomes canvas and nothing else.What does not change
disabled={readOnly}.Verification
bun test srcinpackages/editor— 807 pass / 0 fail, 10357 assertions (8 of them new, inplugin-panels.test.ts).bun run check-typesat the repo root — 11/11 tasks successful.biome check— 1953 files, clean.🤖 Generated with Claude Code