fix(editor): make Settings modal and toolbar trailer truly global#67
Merged
Merged
Conversation
The Settings modal is openable from every admin route, but its General and Publishing sections read site data straight off the heavy editor store, which is only hydrated on the Site editor. On Content / Data / Media / Plugins / Users / Account those sections rendered a permanent skeleton — the modal was "global" in name only. Separately, the settings cog was injected per-layout: Site, Plugins/Users/Account, and Content had it, but Media and Data did not. Fix both: - Hoist SettingsButton into the Toolbar shell so the trailer (Settings → Open live page → Account) is identical on every route, the same way the left nav is. Remove the per-layout/per-page injections (AdminCanvasLayout, AdminPageLayout, ContentToolbar) and the now-dead ToolbarDivider. - Add useSiteSettingsController: one uniform site-settings source that delegates to the editor draft on the Site editor (joins autosave) and loads/saves via cmsAdapter (shell-only write + site-reload event) everywhere else. General and Publishing consume it instead of the editor store directly, so they work on every admin page without forcing editor-store hydration into the light layouts. Co-Authored-By: Claude Opus 4.8 (1M context) <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 changed
Two related fixes so the admin Settings modal and the toolbar settings cog behave globally on every admin route.
1. Settings General + Publishing now load on every page
GeneralSectionandPublishingSectionread site data straight off the heavy editor store (@site/store/store), which is only hydrated byusePersistenceon the Site editor. On Content / Data / Media / Plugins / Users / Account, the editor store'ssiteisnull, so those sections rendered a permanent skeleton (see the original bug screenshots). The modal was "global" in name only.New
useSiteSettingsController(src/admin/modals/Settings/useSiteSettingsController.ts) exposes one uniform site-settings shape and picks the right source:cmsAdapter, edits a local copy, and persists immediately with a shell-onlysaveSite(empty dirty sets → pages/components/layouts untouched), then refreshes theadminUisite summary and firesCMS_SITE_RELOAD_EVENT.The controller is imported only by the lazy
SettingsModalsections, so the editor-store import stays inside the settings chunk and never enters the eager graph of the lightweight layouts — the bundle-isolation contract holds.2. Settings cog is now a consistent, global part of the header
The Toolbar shell already always rendered
OpenLivePageButton+AccountMenuButton, butSettingsButtonwas injected per-layout — Site, Plugins/Users/Account, and Content had it; Media and Data did not.SettingsButtonis hoisted intoToolbar.tsxas part of a fixed global trailer (Settings → Open live page → Account), identical on every route the way the left nav is. Removed the per-layout/per-page injections (AdminCanvasLayout,AdminPageLayout,ContentToolbar) and the now-deadToolbarDivider+.dividerCSS.SettingsButtonreads only the tinyadminUistore, so hosting it in the shell doesn't drag the editor toolchain into non-editor bundles.User/developer impact
Verification
bun run build(tsc -b && vite build) — cleanbun test— 5442 pass, 0 failbun run lint— clean on changed filesUpdated
toolbar.test.ts(settings cog is now asserted in the shell, notAdminCanvasLayout) anddocs/editor.md(global trailer + controller).🤖 Generated with Claude Code