Ebenen-Split: applyVisibility null-safe machen
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user