From 8b58edc061fe2573ec4c980bd7127444b5c8d537 Mon Sep 17 00:00:00 2001 From: Daniel Coutinho <60111446+dcoutinho1328@users.noreply.github.com> Date: Mon, 13 Apr 2026 22:38:38 -0300 Subject: [PATCH 1/2] fix: render web menu on Windows instead of hidden native menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Windows (and Linux), the native Electron menu is created with visible: false, but hasNativeMenu was always true — preventing the web MenuBar component from rendering. Detect macOS via navigator.platform and only set hasNativeMenu: true on macOS where the native menu is visible. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/middleware/editor-platform.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/middleware/editor-platform.ts b/src/middleware/editor-platform.ts index feb611760..b40186b0a 100644 --- a/src/middleware/editor-platform.ts +++ b/src/middleware/editor-platform.ts @@ -37,6 +37,10 @@ export function setRuntimeIpAddress(ip: string): void { _runtimeIpAddress = ip } +// macOS has a native application menu bar; Windows and Linux do not +// (the Electron menu is hidden on those platforms — see menu.ts buildDefaultTemplate). +const isMac = navigator.platform.startsWith('Mac') + /** * Editor platform ports — all port interfaces wired to Electron IPC bridge. */ @@ -52,5 +56,5 @@ export const editorPorts: PlatformPorts = { window: createEditorWindowAdapter(), accelerator: createEditorAcceleratorAdapter(), theme: createEditorThemeAdapter(), - capabilities: { ...EDITOR_CAPABILITIES, isDevMode: process.env.NODE_ENV === 'development' }, + capabilities: { ...EDITOR_CAPABILITIES, isDevMode: process.env.NODE_ENV === 'development', hasNativeMenu: isMac }, } From 10bc01301de89cac68e4ba6f7ea1359953f9ba29 Mon Sep 17 00:00:00 2001 From: Daniel Coutinho <60111446+dcoutinho1328@users.noreply.github.com> Date: Tue, 14 Apr 2026 21:10:47 -0300 Subject: [PATCH 2/2] fix: project creation failing due to incomplete schema defaults and missing file registration getDefaultSchemaValues returned raw {} for ZodDefault wrapping ZodObject instead of recursing into nested fields, causing a TypeError when accessing communicationConfiguration.modbusRTU. Also replaced manual store hydration in the create-project flow with handleOpenProjectResponse, which properly registers files, flows, libraries, and opens the main POU tab. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../shared/utils/default-zod-schema-values.ts | 8 +++++++- .../[start]/new-project/steps/third-step.tsx | 17 ++--------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/backend/shared/utils/default-zod-schema-values.ts b/src/backend/shared/utils/default-zod-schema-values.ts index d0b010b5e..547fe47e9 100644 --- a/src/backend/shared/utils/default-zod-schema-values.ts +++ b/src/backend/shared/utils/default-zod-schema-values.ts @@ -20,7 +20,13 @@ import { } from 'zod' export const getDefaultSchemaValues = (schema: ZodTypeAny): unknown => { - if (schema instanceof ZodDefault) return schema._def.defaultValue() + if (schema instanceof ZodDefault) { + const innerType = schema._def.innerType as ZodTypeAny + if (innerType instanceof ZodObject) { + return getDefaultSchemaValues(innerType) + } + return schema._def.defaultValue() + } if (schema instanceof ZodObject) { const shape = schema.shape return Object.fromEntries(Object.entries(shape).map(([k, v]) => [k, getDefaultSchemaValues(v as ZodTypeAny)])) diff --git a/src/frontend/components/_features/[start]/new-project/steps/third-step.tsx b/src/frontend/components/_features/[start]/new-project/steps/third-step.tsx index e9e5956fd..26f78a7bf 100644 --- a/src/frontend/components/_features/[start]/new-project/steps/third-step.tsx +++ b/src/frontend/components/_features/[start]/new-project/steps/third-step.tsx @@ -42,9 +42,7 @@ const Step3 = ({ onPrev, onFinish, onClose }: { onPrev: () => void; onFinish: () const [intervalValue, setIntervalValue] = useState('T#20ms') const projectPort = useProject() const { - projectActions: { setProject }, - deviceActions: { setDeviceDefinitions }, - workspaceActions: { setEditingState }, + sharedWorkspaceActions: { handleOpenProjectResponse }, } = useOpenPLCStore() const handleFormSubmit: SubmitHandler = async (data) => { @@ -73,18 +71,7 @@ const Step3 = ({ onPrev, onFinish, onClose }: { onPrev: () => void; onFinish: () return } - // Hydrate store with returned project data - setProject({ - meta: result.data.meta, - data: result.data.projectData, - }) - if (result.data.deviceConfiguration || result.data.devicePinMapping) { - setDeviceDefinitions({ - configuration: result.data.deviceConfiguration, - pinMapping: result.data.devicePinMapping, - }) - } - setEditingState('saved') + handleOpenProjectResponse(result.data) } catch (_error) { toast({ title: 'Cannot create a project!',