yjs / y-indexeddb

IndexedDB database adapter for Yjs
https://docs.yjs.dev/ecosystem/database-provider/y-indexeddb
Other
196 stars 30 forks source link

Fix "The database connection is closing" error when create transaction. #13

Open ulion opened 3 years ago

ulion commented 3 years ago

Not sure whether it's proper inside update handler mux use promise. But have to do this to workaround the database error.

dmonad commented 3 years ago

Hi @ulion ,

How can I reproduce the error you are talking about?

ulion commented 3 years ago

It happens when the page reload of my react app's dev mode, the page is dynamic partly reloaded, which cause the same database be closed first or almost same time create new provider so open the other db instance, the new opened one may affected by the closing one, so the transaction failed, re-open normally fix this. without re-open, the sync will be broken in such case. some reports of same error on other repo: https://github.com/jensarps/IDBWrapper/issues/80 Anyway, the db is not reliable always good to use. As a workaround, sent this PR for users need it. But not sure whether it's really proper solution for this.

Kevin Jahns notifications@github.com 于2021年2月23日周二 上午7:01写道:

Hi @ulion https://github.com/ulion ,

How can I reproduce the error you are talking about?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/yjs/y-indexeddb/pull/13#issuecomment-783738717, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABKYHODLDQ64M5X7ZC5IHDTALO27ANCNFSM4YBMSCQA .

-- Ulion