@widgetic/creator 0.4.18 → 0.4.19

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.
@@ -6689,6 +6689,17 @@
6689
6689
  return read;
6690
6690
  }
6691
6691
 
6692
+ /**
6693
+ * A new canvas row is written once, with no content, so its update time is its creation time. Rows without both
6694
+ * times are not judged here (the caller keeps retrying, as before).
6695
+ */
6696
+ function canvasRecordWasNeverSaved(record: Record<string, any> | null): boolean {
6697
+ const createdAt = Date.parse(record?.createdAt ?? record?.created_at ?? '');
6698
+ const updatedAt = Date.parse(record?.updatedAt ?? record?.updated_at ?? '');
6699
+ if (Number.isNaN(createdAt) || Number.isNaN(updatedAt)) return false;
6700
+ return updatedAt - createdAt < 1000;
6701
+ }
6702
+
6692
6703
  /** The site header shows the canvas name; it reads it from here instead of asking the API again. */
6693
6704
  function announceCanvasName(targetCanvasId: string, record: Record<string, any> | null): void {
6694
6705
  const name = String(record?.persistenceKey || record?.persistence_key || '').trim();
@@ -16503,6 +16514,8 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
16503
16514
  }
16504
16515
  canvasContent = canvasRecord?.canvasContent ?? canvasRecord?.canvas_content ?? null;
16505
16516
  if (canvasContent) break;
16517
+ // A canvas that was never saved is empty for certain; waiting for content would take seconds.
16518
+ if (canvasRecordWasNeverSaved(canvasRecord)) break;
16506
16519
  console.log('[CanvasDebug] getCanvas returned no canvasContent, retry', attempt + 1);
16507
16520
  } catch (getErr) {
16508
16521
  console.warn('[CanvasDebug] getCanvas failed, retry', attempt + 1, getErr);
@@ -17877,7 +17890,7 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
17877
17890
  }
17878
17891
  widgetDetails?.closeWidgetDetails();
17879
17892
  }}
17880
- panZoomPosition="TC"
17893
+ panZoomPosition="TL"
17881
17894
  showSaveButton={true}
17882
17895
  autosaveDelayMs={import.meta.env.DEV ? 15000 : 5000}
17883
17896
  suspendAutosave={suspendCanvasAutosave}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widgetic/creator",
3
- "version": "0.4.18",
3
+ "version": "0.4.19",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "type": "module",
6
6
  "peerDependencies": {