windmill-components 1.433.0 → 1.434.1

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.
@@ -67,36 +67,42 @@ function onFlowModuleId() {
67
67
  }
68
68
  }
69
69
  function updateModuleStates(moduleState, key, newValue, keepType) {
70
- moduleState.update((x) => {
71
- if (newValue.selectedForloop != undefined &&
72
- x[key]?.selectedForloop != undefined &&
73
- newValue.selectedForloop != x[key].selectedForloop) {
74
- if (newValue.type == 'InProgress') {
75
- x[key].type = 'InProgress';
76
- }
77
- return x;
78
- }
79
- if (x[key]?.selectedForLoopSetManually) {
80
- if (newValue.selectedForloop != undefined &&
81
- x[key]?.selectedForloop != newValue.selectedForloop) {
82
- return x;
83
- }
84
- else {
85
- newValue.selectedForLoopSetManually = true;
86
- newValue.selectedForloopIndex = x[key]?.selectedForloopIndex;
87
- newValue.selectedForloop = x[key]?.selectedForloop;
88
- }
70
+ const state = get(moduleState);
71
+ if (newValue.selectedForloop != undefined &&
72
+ state[key]?.selectedForloop != undefined &&
73
+ newValue.selectedForloop != state[key].selectedForloop) {
74
+ if (newValue.type == 'InProgress' && state[key]?.type != 'InProgress') {
75
+ moduleState.update((state) => {
76
+ state[key].type = 'InProgress';
77
+ return state;
78
+ });
89
79
  }
90
- else if (x[key]?.selectedForloopIndex != undefined) {
91
- newValue.selectedForloopIndex = x[key]?.selectedForloopIndex;
92
- newValue.selectedForloop = x[key]?.selectedForloop;
80
+ return;
81
+ }
82
+ if (state[key]?.selectedForLoopSetManually) {
83
+ if (newValue.selectedForloop != undefined &&
84
+ state[key]?.selectedForloop != newValue.selectedForloop) {
85
+ return state;
93
86
  }
94
- if (keepType && (x[key]?.type == 'Success' || x[key]?.type == 'Failure')) {
95
- newValue.type = x[key].type;
87
+ else {
88
+ newValue.selectedForLoopSetManually = true;
89
+ newValue.selectedForloopIndex = state[key]?.selectedForloopIndex;
90
+ newValue.selectedForloop = state[key]?.selectedForloop;
96
91
  }
97
- x[key] = newValue;
98
- return x;
99
- });
92
+ }
93
+ else if (state[key]?.selectedForloopIndex != undefined) {
94
+ newValue.selectedForloopIndex = state[key]?.selectedForloopIndex;
95
+ newValue.selectedForloop = state[key]?.selectedForloop;
96
+ }
97
+ if (keepType && (state[key]?.type == 'Success' || state[key]?.type == 'Failure')) {
98
+ newValue.type = state[key].type;
99
+ }
100
+ if (!deepEqual(state[key], newValue)) {
101
+ moduleState.update((state) => {
102
+ state[key] = newValue;
103
+ return state;
104
+ });
105
+ }
100
106
  }
101
107
  function buildSubflowKey(key, prefix) {
102
108
  return prefix ? 'subflow:' + prefix + key : key;
@@ -114,7 +120,6 @@ async function refresh(clearLoop, rootJob) {
114
120
  return x;
115
121
  });
116
122
  }
117
- console.log(rootJob);
118
123
  if (subflowParentsGlobalModuleStates.length > 0) {
119
124
  subflowParentsGlobalModuleStates?.[subflowParentsGlobalModuleStates?.length - 1]?.update((x) => {
120
125
  for (let mod of innerModules ?? []) {
@@ -470,28 +475,39 @@ function onJobsLoaded(mod, job, force) {
470
475
  }
471
476
  async function setIteration(j, id, clicked, modId, isForloop) {
472
477
  if (modId) {
473
- if (clicked) {
474
- await globalRefreshes?.[modId]?.(true, id);
478
+ let globalState = globalModuleStates?.[globalModuleStates?.length - 1];
479
+ let globalStateGet = globalState ? get(globalState) : undefined;
480
+ let state = globalStateGet?.[modId];
481
+ if (clicked && state?.selectedForloop) {
482
+ await globalRefreshes?.[modId]?.(true, state.selectedForloop);
475
483
  }
476
- globalModuleStates?.[globalModuleStates?.length - 1]?.update((topLevelModuleStates) => {
477
- let state = topLevelModuleStates?.[modId];
478
- if (state) {
479
- let manualOnce = state.selectedForLoopSetManually;
480
- if (clicked ||
481
- (!manualOnce &&
482
- (state == undefined || !isForloop || j >= (state.selectedForloopIndex ?? -1)))) {
483
- let setManually = clicked || manualOnce;
484
+ let manualOnce = state?.selectedForLoopSetManually;
485
+ if (clicked ||
486
+ (!manualOnce &&
487
+ (state == undefined || !isForloop || j >= (state.selectedForloopIndex ?? -1)))) {
488
+ let setManually = clicked || manualOnce;
489
+ let newState = {
490
+ ...(state ?? {}),
491
+ selectedForloop: id,
492
+ selectedForloopIndex: j,
493
+ selectedForLoopSetManually: setManually
494
+ };
495
+ const selectedNotEqual = id != state?.selectedForloop ||
496
+ j != state?.selectedForloopIndex ||
497
+ setManually != state?.selectedForLoopSetManually;
498
+ if (selectedNotEqual) {
499
+ console.log('not equal');
500
+ globalState?.update((topLevelModuleStates) => {
484
501
  topLevelModuleStates[modId] = {
485
- ...(topLevelModuleStates[modId] ?? {}),
486
- selectedForloop: id,
487
- selectedForloopIndex: j,
488
- selectedForLoopSetManually: setManually ?? false
502
+ type: 'WaitingForPriorSteps',
503
+ args: {},
504
+ ...newState
489
505
  };
506
+ return topLevelModuleStates;
490
507
  // clicked && callGlobRefresh(modId, {index: j, job: id, selectedManually: setManually ?? false})
491
- }
508
+ });
492
509
  }
493
- return topLevelModuleStates;
494
- });
510
+ }
495
511
  if (clicked) {
496
512
  await globalRefreshes?.[modId]?.(false, id);
497
513
  }
@@ -1033,7 +1049,12 @@ function allModulesForTimeline(modules, expandedSubflows) {
1033
1049
  let detail = e.detail
1034
1050
  if (detail.manuallySet) {
1035
1051
  let rootJobId = detail.id
1036
- await globalRefreshes?.[detail.moduleId]?.(true, rootJobId)
1052
+ await tick()
1053
+
1054
+ let previousId = $localModuleStates[detail.moduleId]?.selectedForloop
1055
+ if (previousId) {
1056
+ await globalRefreshes?.[detail.moduleId]?.(true, previousId)
1057
+ }
1037
1058
 
1038
1059
  $localModuleStates[detail.moduleId] = {
1039
1060
  ...$localModuleStates[detail.moduleId],
@@ -22,7 +22,7 @@ import PanelSection from './settingsPanel/common/PanelSection.svelte';
22
22
  import PreviewToggle from './PreviewToggle.svelte';
23
23
  import ToggleButtonGroup from '../../common/toggleButton-v2/ToggleButtonGroup.svelte';
24
24
  import ToggleButton from '../../common/toggleButton-v2/ToggleButton.svelte';
25
- import UnsavedConfirmationModal from '../../common/confirmationModal/UnsavedConfirmationModal.svelte';
25
+ // import UnsavedConfirmationModal from '../../common/confirmationModal/UnsavedConfirmationModal.svelte'
26
26
  import Tooltip from '../../Tooltip.svelte';
27
27
  import { Sha256 } from '@aws-crypto/sha256-js';
28
28
  import { sendUserToast } from '../../../toast';
@@ -726,7 +726,7 @@ setTheme($app?.darkMode);
726
726
  <svelte:window on:keydown={onKeyDown} />
727
727
 
728
728
  <TestJobLoader bind:this={testJobLoader} bind:isLoading={testIsLoading} bind:job />
729
- <UnsavedConfirmationModal
729
+ <!-- <UnsavedConfirmationModal
730
730
  {diffDrawer}
731
731
  savedValue={savedApp}
732
732
  modifiedValue={{
@@ -738,7 +738,7 @@ setTheme($app?.darkMode);
738
738
  additionalExitAction={() => {
739
739
  setTheme(priorDarkMode)
740
740
  }}
741
- />
741
+ /> -->
742
742
 
743
743
  <DeployOverrideConfirmationModal
744
744
  bind:deployedBy
@@ -29,6 +29,7 @@ import FlowYamlEditor from '../flows/header/FlowYamlEditor.svelte';
29
29
  import BranchOneEndNode from './renderers/nodes/branchOneEndNode.svelte';
30
30
  import { workspaceStore } from '../../stores';
31
31
  import SubflowBound from './renderers/nodes/SubflowBound.svelte';
32
+ import { deepEqual } from 'fast-equals';
32
33
  export let success = undefined;
33
34
  export let modules = [];
34
35
  export let failureModule = undefined;
@@ -172,7 +173,16 @@ let eventHandler = {
172
173
  expandedSubflows = expandedSubflows;
173
174
  }
174
175
  };
175
- $: graph = graphBuilder(modules, {
176
+ let lastModules = structuredClone(modules);
177
+ let newModules = modules;
178
+ $: modules && onModulesChange2(modules);
179
+ function onModulesChange2(modules) {
180
+ if (!deepEqual(modules, lastModules)) {
181
+ lastModules = structuredClone(modules);
182
+ newModules = modules;
183
+ }
184
+ }
185
+ $: graph = graphBuilder(newModules, {
176
186
  disableAi,
177
187
  insertable,
178
188
  flowModuleStates,
@@ -16,6 +16,7 @@ export function graphBuilder(modules, extra, failureModule, preprocessorModule,
16
16
  // flowIsSimplifiable?: boolean
17
17
  // }
18
18
  ) {
19
+ console.debug('Building graph');
19
20
  const nodes = [];
20
21
  const edges = [];
21
22
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-components",
3
- "version": "1.433.0",
3
+ "version": "1.434.1",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build",