jupyterlab-ipyflow 0.0.180 → 0.0.182

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.
Files changed (2) hide show
  1. package/lib/index.js +17 -4
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -144,6 +144,16 @@ function computeTransitiveClosureHelper(closure, cellId, edges) {
144
144
  }
145
145
  children.forEach((child) => computeTransitiveClosureHelper(closure, child, edges));
146
146
  }
147
+ function mergeMaps(priority, backup) {
148
+ const merged = {};
149
+ for (const key in backup) {
150
+ merged[key] = backup[key];
151
+ }
152
+ for (const key in priority) {
153
+ merged[key] = priority[key];
154
+ }
155
+ return merged;
156
+ }
147
157
  /**
148
158
  * Initialization data for the jupyterlab-ipyflow extension.
149
159
  */
@@ -742,7 +752,7 @@ const connectToComm = (session, notebooks, notebook) => {
742
752
  };
743
753
  notebooks.selectionChanged.connect(onSelectionChanged);
744
754
  comm.onMsg = (msg) => {
745
- var _a, _b;
755
+ var _a, _b, _c, _d;
746
756
  const payload = msg.content.data;
747
757
  if (disconnected || !((_a = payload.success) !== null && _a !== void 0 ? _a : true)) {
748
758
  return;
@@ -761,8 +771,11 @@ const connectToComm = (session, notebooks, notebook) => {
761
771
  }
762
772
  else if (payload.type === 'compute_exec_schedule') {
763
773
  state.settings = payload.settings;
764
- state.cellParents = payload.cell_parents;
765
- state.cellChildren = payload.cell_children;
774
+ const ipyflow_metadata = notebook.model.getMetadata('ipyflow');
775
+ const parentsFromMetadata = (_b = ipyflow_metadata === null || ipyflow_metadata === void 0 ? void 0 : ipyflow_metadata.cell_parents) !== null && _b !== void 0 ? _b : {};
776
+ const childrenFromMetadata = (_c = ipyflow_metadata === null || ipyflow_metadata === void 0 ? void 0 : ipyflow_metadata.cell_children) !== null && _c !== void 0 ? _c : {};
777
+ state.cellParents = mergeMaps(payload.cell_parents, parentsFromMetadata);
778
+ state.cellChildren = mergeMaps(payload.cell_children, childrenFromMetadata);
766
779
  notebook.model.setMetadata('ipyflow', {
767
780
  cell_parents: state.cellParents,
768
781
  cell_children: state.cellChildren,
@@ -790,7 +803,7 @@ const connectToComm = (session, notebooks, notebook) => {
790
803
  const exec_mode = payload.exec_mode;
791
804
  state.isReactivelyExecuting =
792
805
  state.isReactivelyExecuting ||
793
- ((_b = payload === null || payload === void 0 ? void 0 : payload.is_reactively_executing) !== null && _b !== void 0 ? _b : false) ||
806
+ ((_d = payload === null || payload === void 0 ? void 0 : payload.is_reactively_executing) !== null && _d !== void 0 ? _d : false) ||
794
807
  exec_mode === 'reactive';
795
808
  if (exec_mode === 'reactive') {
796
809
  state.newReadyCells = new Set([
package/package.json CHANGED
@@ -67,5 +67,5 @@
67
67
  "extension": true,
68
68
  "outputDir": "../../core/ipyflow/resources/labextension/"
69
69
  },
70
- "version": "0.0.180"
70
+ "version": "0.0.182"
71
71
  }