jupyterlab-ipyflow 0.0.209 → 0.0.211

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 +34 -18
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -204,23 +204,32 @@ class IpyflowSessionState {
204
204
  .sort((a, b) => orderIdxById[a] - orderIdxById[b])
205
205
  .map((id) => this.cellsById[id]);
206
206
  }
207
- computeTransitiveClosure(cellIds, inclusive = true, parents = false) {
208
- const closure = new Set();
209
- for (const cellId of cellIds) {
210
- if (parents) {
211
- this.computeTransitiveClosureHelper(closure, cellId, this.cellParents);
207
+ computeTransitiveClosure(startCellIds, inclusive = true, parents = false) {
208
+ var _a, _b;
209
+ let cellIds = startCellIds;
210
+ const closure = new Set(cellIds);
211
+ while (true) {
212
+ for (const cellId of cellIds) {
213
+ if (parents) {
214
+ this.computeTransitiveClosureHelper(closure, cellId, this.cellParents, false, true);
215
+ }
216
+ else {
217
+ this.computeTransitiveClosureHelper(closure, cellId, this.cellChildren, false, true);
218
+ }
212
219
  }
213
- else {
214
- this.computeTransitiveClosureHelper(closure, cellId, this.cellChildren);
220
+ if (parents || !((_a = this.settings.pull_reactive_updates) !== null && _a !== void 0 ? _a : false)) {
221
+ break;
215
222
  }
216
- }
217
- if (!parents) {
218
223
  for (const cellId of closure) {
219
224
  this.computeTransitiveClosureHelper(closure, cellId, this.cellParents, true, true);
220
225
  }
226
+ if (cellIds.length === closure.size || !((_b = this.settings.push_reactive_updates_to_cousins) !== null && _b !== void 0 ? _b : false)) {
227
+ break;
228
+ }
229
+ cellIds = Array.from(closure);
221
230
  }
222
231
  if (!inclusive) {
223
- for (const cellId of cellIds) {
232
+ for (const cellId of startCellIds) {
224
233
  closure.delete(cellId);
225
234
  }
226
235
  }
@@ -862,23 +871,30 @@ const connectToComm = (session, notebooks, notebook) => {
862
871
  }
863
872
  };
864
873
  const updateUI = (notebook) => {
865
- var _a;
874
+ var _a, _b;
866
875
  clearCellState(notebook);
867
876
  refreshNodeMapping(notebook);
868
- const slice = new Set();
869
877
  let closureCellIds = state.selectedCells;
870
878
  if (closureCellIds.length === 0) {
871
879
  closureCellIds = [state.activeCell.model.id];
872
880
  }
873
- for (const cellId of closureCellIds) {
874
- state.computeTransitiveClosureHelper(slice, cellId, state.cellChildren);
875
- }
876
- const executeSlice = new Set(slice);
877
- if ((_a = state.settings.pull_reactive_updates) !== null && _a !== void 0 ? _a : false) {
878
- for (const cellId of slice) {
881
+ const executeSlice = new Set(closureCellIds);
882
+ while (true) {
883
+ for (const cellId of closureCellIds) {
884
+ state.computeTransitiveClosureHelper(executeSlice, cellId, state.cellChildren, false, true);
885
+ }
886
+ if (!((_a = state.settings.pull_reactive_updates) !== null && _a !== void 0 ? _a : false)) {
887
+ break;
888
+ }
889
+ for (const cellId of executeSlice) {
879
890
  state.computeTransitiveClosureHelper(executeSlice, cellId, state.cellParents, true, true);
880
891
  }
892
+ if (executeSlice.size === closureCellIds.length || !((_b = state.settings.push_reactive_updates_to_cousins) !== null && _b !== void 0 ? _b : false)) {
893
+ break;
894
+ }
895
+ closureCellIds = Array.from(executeSlice);
881
896
  }
897
+ const slice = new Set(executeSlice);
882
898
  for (const cellId of closureCellIds) {
883
899
  slice.delete(cellId);
884
900
  state.computeTransitiveClosureHelper(slice, cellId, state.cellParents);
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.209"
70
+ "version": "0.0.211"
71
71
  }