fix: component port labels showing wrong name after editing blueprint
The label lookup in drawComponentGate read from gate.component (potentially stale copy) while gateOutputCount read from state.customComponents (updated definition), causing a mismatch — fewer ports but old outputIds, so the first (deleted) output's label was shown instead of the surviving one. Three fixes: - renderer: use customComponents as authoritative source for label lookup - saveLoad: re-link gate.component refs to customComponents after loading - components: update existing instances even when a "new" component overwrites an existing definition with the same name Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -56,6 +56,16 @@ export function loadState(data) {
|
||||
state.customComponents = JSON.parse(JSON.stringify(data.components));
|
||||
}
|
||||
|
||||
// Re-link gate.component references to customComponents (authoritative source)
|
||||
for (const gate of state.gates) {
|
||||
if (gate.type.startsWith('COMPONENT:')) {
|
||||
const compId = gate.type.substring(10);
|
||||
if (state.customComponents[compId]) {
|
||||
gate.component = state.customComponents[compId];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load progress
|
||||
if (data.progress) {
|
||||
progress.unlockedLevels = data.progress.unlockedLevels || ['buffer'];
|
||||
|
||||
Reference in New Issue
Block a user