From 12d2f79d0296846f08fce9fa536d3aaac599efe0 Mon Sep 17 00:00:00 2001 From: SylvainDruaux Date: Tue, 20 Oct 2026 15:20:54 +0200 Subject: [PATCH] fix(studio): load the variable list before the style panel opens Studio set the project for the variable picker only when the style panel showed an element. A picker opened earlier found no project and kept an empty list for the session. The editor now sets the same project when it opens. --- studio/src/app/Editor.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/studio/src/app/Editor.tsx b/studio/src/app/Editor.tsx index 09f8f1ea..8020194c 100644 --- a/studio/src/app/Editor.tsx +++ b/studio/src/app/Editor.tsx @@ -20,6 +20,7 @@ import type { ComponentFocus, OpenFile } from '../features/project/editorNavigat import { VariablesWorkspace } from '../features/variables/VariablesWorkspace'; import { CodePopup } from '../features/code/CodePopup'; import { CodeAccess } from '../../vendor/stacki/src/ui/CodeAccess'; +import { getHost, setHost } from '../../vendor/stacki/src/features/style/model/host'; import { PreviewWorkspace, useInteractivePreview } from '../features/preview/InteractivePreview'; export interface EditorProps { readonly session: Session | undefined; @@ -112,6 +113,14 @@ function useComponentPanel(componentOpen: boolean, setPanel: EditorProps['view'] } }, [componentOpen, setPanel]); } +// Variable pickers read the project from the style panel's shared host. Set it here, +// with the project StyleSettings.tsx passes, so a picker opened before that panel +// still lists the project's variables. +function useStyleProject() { + useEffect(() => { + setHost({ ...getHost(), projectPath: 'studio' }); + }, []); +} function EditorContent({ props, model, @@ -124,6 +133,7 @@ function EditorContent({ readonly setMobileSettings: (visible: boolean) => void; }) { const { device, setDevice, setPanel } = props.view; + useStyleProject(); return (