diff --git a/packages/dev/src/hooks/usePersistence.tsx b/packages/dev/src/hooks/usePersistence.tsx index 6b20868a7..e22d0c92f 100644 --- a/packages/dev/src/hooks/usePersistence.tsx +++ b/packages/dev/src/hooks/usePersistence.tsx @@ -60,7 +60,9 @@ export function usePersistence(id: string, doc: TLDrawDocument) { const db = await openDB('db', VERSION, { upgrade(db, oldVersion, newVersion) { if (newVersion) { - db.deleteObjectStore('documents') + if (newVersion > oldVersion) { + db.deleteObjectStore('documents') + } db.createObjectStore('documents') } }, diff --git a/packages/tldraw/src/state/command/duplicate-page/duplicate-page.command.ts b/packages/tldraw/src/state/command/duplicate-page/duplicate-page.command.ts index e54379e55..fc9ab4f35 100644 --- a/packages/tldraw/src/state/command/duplicate-page/duplicate-page.command.ts +++ b/packages/tldraw/src/state/command/duplicate-page/duplicate-page.command.ts @@ -5,8 +5,6 @@ export function duplicatePage(data: Data, pageId: string): Command { const newId = Utils.uniqueId() const { currentPageId } = data.appState - console.log('duplicating') - const page = data.document.pages[pageId] const nextPage = { diff --git a/packages/www/hooks/usePersistence.tsx b/packages/www/hooks/usePersistence.tsx index 7110c5b09..5fca5c9b4 100644 --- a/packages/www/hooks/usePersistence.tsx +++ b/packages/www/hooks/usePersistence.tsx @@ -60,7 +60,9 @@ export function usePersistence(id: string, doc: TLDrawDocument) { const db1 = await openDB('db1', VERSION, { upgrade(db, oldVersion, newVersion) { if (newVersion) { - db.deleteObjectStore('documents') + if (newVersion > oldVersion) { + db.deleteObjectStore('documents') + } db.createObjectStore('documents') } },