@bian-womp/spark-workbench 0.3.64 → 0.3.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.cjs CHANGED
@@ -1372,10 +1372,15 @@ class LocalGraphRunner extends AbstractGraphRunner {
1372
1372
  Array.isArray(this.extData)) {
1373
1373
  this.extData = {};
1374
1374
  }
1375
+ let hasCustomUpdate = false;
1375
1376
  for (const { path, value } of updates) {
1376
1377
  const pathSegments = sparkGraph.parseJsonPath(path);
1377
- sparkGraph.setValueAtPathWithCreation(this.extData, pathSegments, value);
1378
+ const updated = sparkGraph.setValueAtPathWithCreation(this.extData, pathSegments, value);
1379
+ if (updated && pathSegments.length > 0 && pathSegments[0] === "custom") {
1380
+ hasCustomUpdate = true;
1381
+ }
1378
1382
  }
1383
+ return hasCustomUpdate;
1379
1384
  }
1380
1385
  async snapshotFull() {
1381
1386
  const def = undefined; // UI will supply def/positions on download for local
@@ -1980,7 +1985,7 @@ class RemoteGraphRunner extends AbstractGraphRunner {
1980
1985
  }
1981
1986
  async updateExtData(updates) {
1982
1987
  const client = await this.ensureClient();
1983
- await client.api.updateExtData(updates);
1988
+ return await client.api.updateExtData(updates);
1984
1989
  }
1985
1990
  async commit(reason) {
1986
1991
  const client = await this.ensureClient();
@@ -4143,17 +4148,18 @@ function WorkbenchProvider({ wb, runner, overrides, uiVersion, children, }) {
4143
4148
  // Helper to save runtime metadata and UI state to extData
4144
4149
  const saveUiRuntimeMetadata = React.useCallback(async (workbench, graphRunner) => {
4145
4150
  try {
4146
- const current = workbench.getRuntimeState() ?? { nodes: {} };
4147
- const metadata = { nodes: { ...current.nodes } };
4151
+ const currentRuntime = workbench.getRuntimeState() ?? { nodes: {} };
4152
+ const runtimeMetaData = { nodes: { ...currentRuntime.nodes } };
4153
+ const customMetaData = workbench.getCustomData();
4148
4154
  // Clean up metadata for nodes that no longer exist
4149
4155
  const nodeIds = new Set(workbench.def.nodes.map((n) => n.nodeId));
4150
- for (const nodeId of Object.keys(metadata.nodes)) {
4156
+ for (const nodeId of Object.keys(runtimeMetaData.nodes)) {
4151
4157
  if (!nodeIds.has(nodeId)) {
4152
- delete metadata.nodes[nodeId];
4158
+ delete runtimeMetaData.nodes[nodeId];
4153
4159
  }
4154
4160
  }
4155
4161
  // Save cleaned metadata to workbench state
4156
- workbench.setRuntimeState(metadata);
4162
+ workbench.setRuntimeState(runtimeMetaData);
4157
4163
  const fullUiState = workbench.getUIState();
4158
4164
  const uiWithoutViewport = excludeViewportFromUIState(fullUiState);
4159
4165
  // Use updateExtData for efficient batched partial updates
@@ -4161,7 +4167,8 @@ function WorkbenchProvider({ wb, runner, overrides, uiVersion, children, }) {
4161
4167
  if (Object.keys(uiWithoutViewport || {}).length > 0) {
4162
4168
  updates.push({ path: "ui", value: uiWithoutViewport });
4163
4169
  }
4164
- updates.push({ path: "runtime", value: metadata });
4170
+ updates.push({ path: "runtime", value: runtimeMetaData });
4171
+ updates.push({ path: "custom", value: customMetaData });
4165
4172
  await graphRunner.updateExtData(updates);
4166
4173
  }
4167
4174
  catch (err) {