From cbabc12064b74fd2147eaf74073fed2eb6dbe709 Mon Sep 17 00:00:00 2001 From: karim Date: Mon, 18 May 2026 23:55:13 +0200 Subject: [PATCH] Ebenen-Split: applyVisibility null-safe machen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit App.jsx ruft jetzt `applyVisibility(null, [], activeCode, ebenen, null, eMode)` — die fremde Slice ist leer/null weil das Panel sie nicht besitzt. Das crashte mit "Cannot read properties of null (reading 'id')" weil der Code `a.activeZ.id` blind dereferenzierte. Resultat: "Script error." in window.onerror → leere Panel-UI. Fix: Array.isArray-Guard + null-Check fuer activeZ. Backend mergt fehlende Felder mit doc.Strings. Co-Authored-By: Claude Opus 4.7 --- src/lib/rhinoBridge.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/rhinoBridge.js b/src/lib/rhinoBridge.js index a4068c2..88f225a 100644 --- a/src/lib/rhinoBridge.js +++ b/src/lib/rhinoBridge.js @@ -278,19 +278,23 @@ export function saveCurrentAsCombination(name) { send('SAVE_CURRENT_AS_PRESET' export function deleteCombinationPreset(name) { send('DELETE_PRESET', { name }) } export function applyVisibility(activeZ, zeichnungsebenen, activeCode, ebenen, zMode, eMode) { + // Split-Panels koennen mit null/[] fuer fremde Slice aufrufen — Backend + // fuellt aus doc.Strings. Hier robust gegen alles Falsy. _visArgs = { activeZ, zeichnungsebenen, activeCode, ebenen, zMode, eMode } if (_visTimer) clearTimeout(_visTimer) _visTimer = setTimeout(() => { _visTimer = null const a = _visArgs - const slimZ = a.zeichnungsebenen.map(z => ({ + const zList = Array.isArray(a.zeichnungsebenen) ? a.zeichnungsebenen : [] + const eList = Array.isArray(a.ebenen) ? a.ebenen : [] + const slimZ = zList.map(z => ({ id: z.id, name: z.name, visible: z.visible !== false, })) - const slimE = a.ebenen.map(e => ({ + const slimE = eList.map(e => ({ code: e.code, visible: e.visible !== false, locked: e.locked === true, })) send('SET_VISIBILITY', { - activeZ: { id: a.activeZ.id }, + activeZ: a.activeZ ? { id: a.activeZ.id } : null, activeCode: a.activeCode, zeichnungsebenen: slimZ, ebenen: slimE,