From 51461ff5f299d5e725e4d0c33dcd4c999b37f5ae Mon Sep 17 00:00:00 2001 From: timeTable2 dev Date: Mon, 13 Jul 2026 20:13:19 +0800 Subject: [PATCH] fix: use JSON clone instead of structuredClone for Vue reactive proxies structuredClone cannot clone Vue reactive Proxy objects (DataCloneError). EventModel contains only plain data, so JSON round-trip is safe and lossless. Verified: organize, toggle, undo, download all work correctly. --- src/lib/event-factory.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lib/event-factory.js b/src/lib/event-factory.js index 0dff148..925cfb3 100644 --- a/src/lib/event-factory.js +++ b/src/lib/event-factory.js @@ -30,12 +30,13 @@ export function createEvent(overrides = {}) { } /** - * Deep-clone an event via structuredClone (available in modern browsers - * and Node 17+). Falls back to JSON round-trip for older environments. + * Deep-clone an event (or any plain-data object). + * + * Uses JSON round-trip rather than structuredClone because events may be + * wrapped in Vue reactive proxies, which structuredClone cannot handle. + * EventModel contains only plain data (strings, arrays, nested objects), + * so JSON cloning is safe and lossless here. */ export function cloneEvent(ev) { - if (typeof structuredClone === 'function') { - return structuredClone(ev) - } return JSON.parse(JSON.stringify(ev)) }