Repository navigation
feat(site-editor): remember the preview device size and editing mode across reloads - #8031
Merged
Merged
Conversation
pedrofrxncx
marked this pull request as ready for review
October 16, 2026 16:01
pedrofrxncx
enabled auto-merge (squash)
October 16, 2026 16:01
decocms Bot
pushed a commit
that referenced
this pull request
Oct 16, 2026
PR: #8031 feat(site-editor): remember the preview device size and editing mode across reloads Bump type: minor - decocms (apps/api/package.json): 4.494.0 -> 4.495.0 Deploy-Scope: web
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 is this contribution about?
Reloading the Site Editor reset the preview to desktop and to the default editing mode, so a user previewing on mobile, or who had closed Blocks, lost that state on every refresh.
The Preview device size (desktop / mobile / tablet) and the editing mode (preview / visual / blocks) now persist in localStorage per project, through the existing
useLocalStoragehook. The editing mode stays unset until the user picks one, so a first visit still gets the gated default (Blocks on desktop when content editing is on). Stored values outside the known set fall back to the defaults, and a restored Blocks mode on a project where Blocks is gated still renders the plain preview throughresolveEffectivePreviewEditingMode.The Preview / Content / Code switch is already route-owned (
/site-editor,/site-editor/content,/site-editor/code), so a refresh keeps it; nothing changes there.How did you verify your code works?
apps/web:tsc --noEmitpasses.bun test apps/web/src/components/sandbox/preview: 238 pass, 0 fail.bun run fmt,bun run lintandbun run knippass. The fullbun testrun reported failures in unrelated suites (e.g.plugins/ban-cross-tree-imports.test.tsfailing on empty oxlint JSON output); that file passes when run on its own, both with and without this change.Screenshots/Demonstration
Pending.
How to Test
Review Checklist
Summary by cubic
Reloading the Site Editor no longer resets the preview to desktop or to the default editing mode. Device size (desktop/mobile/tablet) and editing mode (preview/visual/blocks) now persist in localStorage per project through the existing
useLocalStoragehook, so a mobile preview or a closed Blocks panel survives a refresh.resolveEffectivePreviewEditingMode.Written for commit d226048. Summary will update on new commits.