Fix bug with db
This commit is contained in:
parent
aa20ed8d63
commit
74f600aac2
3 changed files with 6 additions and 4 deletions
|
@ -60,7 +60,9 @@ export function usePersistence(id: string, doc: TLDrawDocument) {
|
|||
const db = await openDB<TLDatabase>('db', VERSION, {
|
||||
upgrade(db, oldVersion, newVersion) {
|
||||
if (newVersion) {
|
||||
db.deleteObjectStore('documents')
|
||||
if (newVersion > oldVersion) {
|
||||
db.deleteObjectStore('documents')
|
||||
}
|
||||
db.createObjectStore('documents')
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -60,7 +60,9 @@ export function usePersistence(id: string, doc: TLDrawDocument) {
|
|||
const db1 = await openDB<TLDatabase>('db1', VERSION, {
|
||||
upgrade(db, oldVersion, newVersion) {
|
||||
if (newVersion) {
|
||||
db.deleteObjectStore('documents')
|
||||
if (newVersion > oldVersion) {
|
||||
db.deleteObjectStore('documents')
|
||||
}
|
||||
db.createObjectStore('documents')
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue