jupyterlab-ipyflow 0.0.178 → 0.0.179

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 +16 -13
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -70,20 +70,13 @@ class IpyflowSessionState {
70
70
  let numFinished = 0;
71
71
  for (const cell of cells) {
72
72
  // if any of them fail, change the [*] to [ ] on subsequent cells
73
- CodeCell.execute(cell, this.session).then((msg) => {
74
- var _a, _b, _c;
75
- if (((_b = (_a = msg) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.status) === 'error') {
76
- numFinished = cells.length;
77
- for (const cell of cells) {
78
- if ((_c = cell.promptNode.textContent) === null || _c === void 0 ? void 0 : _c.includes('[*]')) {
79
- cell.setPrompt('');
80
- }
81
- }
73
+ CodeCell.execute(cell, this.session).then(() => {
74
+ var _a;
75
+ if ((_a = cell.promptNode.textContent) === null || _a === void 0 ? void 0 : _a.includes('[*]')) {
76
+ // can happen if a preceding cell errored
77
+ cell.setPrompt('');
82
78
  }
83
- else {
84
- numFinished++;
85
- }
86
- if (numFinished === cells.length) {
79
+ if (++numFinished === cells.length) {
87
80
  this.requestComputeExecSchedule();
88
81
  }
89
82
  });
@@ -507,6 +500,7 @@ const addUnsafeCellInteraction = (elem, linkedElems, cellsById, collapserFun, ev
507
500
  attachCleanupListener(elem, evt, listener);
508
501
  };
509
502
  const connectToComm = (session, notebooks, notebook) => {
503
+ var _a, _b;
510
504
  initSessionState(session.session.id);
511
505
  const state = ipyflowState[session.session.id];
512
506
  state.activeCell = notebook.activeCell;
@@ -762,6 +756,11 @@ const connectToComm = (session, notebooks, notebook) => {
762
756
  state.settings = payload.settings;
763
757
  state.cellParents = payload.cell_parents;
764
758
  state.cellChildren = payload.cell_children;
759
+ notebook.model.setMetadata('ipyflow', {
760
+ cell_parents: state.cellParents,
761
+ cell_children: state.cellChildren,
762
+ });
763
+ void notebooks.currentWidget.context.save();
765
764
  state.waitingCells = new Set(payload.waiting_cells);
766
765
  state.readyCells = new Set(payload.ready_cells);
767
766
  if (state.numPendingForcedReactiveCounterBumps === 0) {
@@ -910,8 +909,12 @@ const connectToComm = (session, notebooks, notebook) => {
910
909
  }
911
910
  }
912
911
  };
912
+ const ipyflow_metadata = notebook.model.getMetadata('ipyflow');
913
913
  comm.open({
914
914
  interface: 'jupyterlab',
915
+ cell_metadata_by_id: state.gatherCellMetadataAndContent(),
916
+ cell_parents: (_a = ipyflow_metadata === null || ipyflow_metadata === void 0 ? void 0 : ipyflow_metadata.cell_parents) !== null && _a !== void 0 ? _a : {},
917
+ cell_children: (_b = ipyflow_metadata === null || ipyflow_metadata === void 0 ? void 0 : ipyflow_metadata.cell_children) !== null && _b !== void 0 ? _b : {},
915
918
  });
916
919
  // return a disconnection handle
917
920
  return () => {
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.178"
70
+ "version": "0.0.179"
71
71
  }