diff --git a/src/lib/state/popup.svelte.ts b/src/lib/state/popup.svelte.ts index bb5b86d..e025bdd 100644 --- a/src/lib/state/popup.svelte.ts +++ b/src/lib/state/popup.svelte.ts @@ -25,6 +25,7 @@ export interface PopupState { function createPopups() { const { subscribe, update, set } = writable([]); + let count = 0; return { subscribe, @@ -32,13 +33,15 @@ function createPopups() { let onclose: (value: any) => void; const promise = new Promise((resolve) => (onclose = resolve)); const state: PopupState = { - id: crypto.randomUUID(), + id: `${count}`, position: { x: 0, y: 0 }, popup, onclose, anchor: Anchor.Center, ...initialState, }; + count++; + if (count > 1000) count = 0; update((popups) => { if ( popups.find( diff --git a/src/lib/state/workspace.svelte.ts b/src/lib/state/workspace.svelte.ts index 4d4dfa5..3ff52ff 100644 --- a/src/lib/state/workspace.svelte.ts +++ b/src/lib/state/workspace.svelte.ts @@ -68,6 +68,7 @@ let writer: WritableStreamDefaultWriter; function createLogState() { const { subscribe, update, set } = writable([]); let buffer = ""; + let count = 0; return { subscribe, @@ -96,12 +97,14 @@ function createLogState() { [ ...log, ...items.map((content) => ({ - id: crypto.randomUUID(), + id: `${count}`, date: new Date(), content, })), ].slice(-100), ); + count++; + if (count > 100) count = 0; } }, };