Fix bug with db

pull/71/head
Steve Ruiz 2021-08-18 07:04:01 +01:00
rodzic aa20ed8d63
commit 74f600aac2
3 zmienionych plików z 6 dodań i 4 usunięć

Wyświetl plik

@ -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')
}
},

Wyświetl plik

@ -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 = {

Wyświetl plik

@ -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')
}
},