Handle db versionchange
This commit is contained in:
parent
e1e3a53942
commit
6dfeb874a7
@ -39,6 +39,10 @@ export function DatabaseProvider({ children }) {
|
|||||||
db.on("ready", () => {
|
db.on("ready", () => {
|
||||||
setDatabaseStatus("loaded");
|
setDatabaseStatus("loaded");
|
||||||
});
|
});
|
||||||
|
db.on("versionchange", () => {
|
||||||
|
// When another tab loads a new version of the database refresh the page
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
await db.open();
|
await db.open();
|
||||||
window.indexedDB.deleteDatabase("__test");
|
window.indexedDB.deleteDatabase("__test");
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user