Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

chore: fix pages switcher in preview (#3975)

Oleg Isonene33f26a30c5b
diff --git a/apps/builder/app/builder/shared/commands.ts b/apps/builder/app/builder/shared/commands.ts
index d465e59614..f10d74fd79 100644
--- a/apps/builder/app/builder/shared/commands.ts
+++ b/apps/builder/app/builder/shared/commands.ts
@@ -126,6 +126,7 @@ export const { emitCommand, subscribeCommands } = createCommandsEmitter({
defaultHotkeys: ["meta+shift+p", "ctrl+shift+p"],
handler: () => {
$isPreviewMode.set($isPreviewMode.get() === false);
+ setActiveSidebarPanel();
},
},
{
diff --git a/apps/builder/app/builder/shared/nano-states/index.ts b/apps/builder/app/builder/shared/nano-states/index.ts
index 3b4fd1025e..9cdd113f26 100644
--- a/apps/builder/app/builder/shared/nano-states/index.ts
+++ b/apps/builder/app/builder/shared/nano-states/index.ts
@@ -97,9 +97,12 @@ const $activeSidebarPanel_ = atom<SidebarPanelName | undefined>();
export const $activeSidebarPanel = computed(
[$activeSidebarPanel_, $isPreviewMode, $loadingState, $settings],
(currentPanel, isPreviewMode, loadingState, { navigatorLayout }) => {
- if (isPreviewMode || loadingState.state !== "ready") {
+ if (loadingState.state !== "ready") {
return "none";
}
+ if (isPreviewMode) {
+ return currentPanel === "pages" ? "pages" : "none";
+ }
if (currentPanel === undefined) {
return navigatorLayout === "undocked" ? "navigator" : "none";
}