Handle db versionchange

This commit is contained in:
Mitchell McCaffrey 2021-06-24 13:06:00 +10:00
parent e1e3a53942
commit 6dfeb874a7

View File

@ -39,6 +39,10 @@ export function DatabaseProvider({ children }) {
db.on("ready", () => {
setDatabaseStatus("loaded");
});
db.on("versionchange", () => {
// When another tab loads a new version of the database refresh the page
window.location.reload();
});
await db.open();
window.indexedDB.deleteDatabase("__test");
};