Skip to content

Commit cb40da6

Browse files
authored
Safer restoration of widgets_values on subgraph nodes (#6015)
Reordering linked widgets requires special attention on load to restore widgets_values. The method which was merged was optimistic and insufficient for some rarer edge cases. Resolves #6014 Fix was already included in #6009. Backport is not required. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6015-Safer-restoration-of-widgets_values-on-subgraph-nodes-2896d73d3650813a9162e8459e686981) by [Unito](https://www.unito.io)
1 parent ddb3a0b commit cb40da6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/core/graph/subgraph/proxyWidget.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,14 @@ const onConfigure = function (
115115
this.arrange()
116116
}
117117
})
118-
if (serialisedNode.properties?.proxyWidgets)
118+
if (serialisedNode.properties?.proxyWidgets) {
119119
this.properties.proxyWidgets = serialisedNode.properties.proxyWidgets
120-
serialisedNode.widgets_values?.forEach((v, index) => {
121-
if (v !== null) this.widgets[index].value = v
122-
})
120+
const parsed = parseProxyWidgets(serialisedNode.properties.proxyWidgets)
121+
serialisedNode.widgets_values?.forEach((v, index) => {
122+
const widget = this.widgets.find((w) => w.name == parsed[index][1])
123+
if (v !== null && widget) widget.value = v
124+
})
125+
}
123126
}
124127

125128
function newProxyWidget(

0 commit comments

Comments
 (0)