windmill-components 1.504.3 → 1.504.4

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.
@@ -779,15 +779,14 @@ const flowHasChanged = $derived(flowPreviewContent?.flowHasChanged());
779
779
  disabled={customUi?.topBar?.editableSummary == false}
780
780
  bind:value={flowStore.val.summary}
781
781
  />
782
-
783
782
  <UndoRedo
784
783
  undoProps={{ disabled: $history.index === 0 }}
785
784
  redoProps={{ disabled: $history.index === $history.history.length - 1 }}
786
785
  on:undo={() => {
787
786
  const currentModules = flowStore.val?.value?.modules
788
- console.log('undo before', flowStore.val, JSON.stringify(flowStore.val, null, 2))
787
+ // console.log('undo before', flowStore.val, JSON.stringify(flowStore.val, null, 2))
789
788
  flowStore.val = undo(history, flowStore.val)
790
- console.log('undo after', flowStore.val, JSON.stringify(flowStore.val, null, 2))
789
+ // console.log('undo after', flowStore.val, JSON.stringify(flowStore.val, null, 2))
791
790
 
792
791
  const newModules = flowStore.val?.value?.modules
793
792
  const restoredModules = newModules?.filter(
@@ -262,7 +262,7 @@ let eventHandler = {
262
262
  onHideJobStatus?.();
263
263
  }
264
264
  };
265
- let lastModules = structuredClone($state.snapshot(modules));
265
+ let lastModules = $state.snapshot(modules);
266
266
  let moduleCounter = $state(0);
267
267
  function onModulesChange2(modules) {
268
268
  if (!deepEqual(modules, lastModules)) {
@@ -8,7 +8,8 @@ export function undo(history, now) {
8
8
  let chistory = get(history);
9
9
  if (chistory.index == 0)
10
10
  return now;
11
- if (!deepEqual(chistory.history[chistory.index], now)) {
11
+ if (chistory.index == chistory.history.length - 1 &&
12
+ !deepEqual(chistory.history[chistory.index], now)) {
12
13
  push(history, now, true);
13
14
  }
14
15
  else {
@@ -20,10 +21,12 @@ export function undo(history, now) {
20
21
  let nhistory = get(history);
21
22
  let r = nhistory.history[nhistory.index];
22
23
  if (!r) {
24
+ console.log('c');
23
25
  console.log('undo failed', nhistory, now);
24
26
  return now;
25
27
  }
26
28
  else {
29
+ console.log('d');
27
30
  return r;
28
31
  }
29
32
  }
package/package/utils.js CHANGED
@@ -1202,12 +1202,11 @@ export function scroll_into_view_if_needed_polyfill(elem, centerIfNeeded = true)
1202
1202
  observer.observe(elem);
1203
1203
  return observer; // return for testing
1204
1204
  }
1205
+ // Structured clone raises an error on $state values
1206
+ // $state.snapshot clones everything but prints warnings for some values (e.g. functions)
1207
+ import _clone from 'clone';
1205
1208
  export function clone(t) {
1206
- if (typeof t === 'function')
1207
- throw new Error('Cannot clone a function');
1208
- if (typeof t === 'object')
1209
- return stateSnapshot(t);
1210
- return t;
1209
+ return _clone(t);
1211
1210
  }
1212
1211
  export const editorPositionMap = {};
1213
1212
  export function parseS3Object(s3Object) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-components",
3
- "version": "1.504.3",
3
+ "version": "1.504.4",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build",
@@ -103,6 +103,7 @@
103
103
  "chart.js": "^4.4.6",
104
104
  "chartjs-adapter-date-fns": "^3.0.0",
105
105
  "chartjs-plugin-zoom": "^2.0.0",
106
+ "clone": "^2.1.2",
106
107
  "d3-zoom": "^3.0.0",
107
108
  "date-fns": "^2.30.0",
108
109
  "diff": "^7.0.0",