-
-
Notifications
You must be signed in to change notification settings - Fork 694
Dexie returns duplicated object after manually deleting the database and re-populate it. #2011
Copy link
Copy link
Closed
Labels
Description
After deleting Dexie database manually, if you do not refresh the page, it will return duplicated data, even though the chrome inspector shows there are no duplicated rows in the IndexedDB. However, the issue goes away when you refresh the page right away after each database deletion.
db config:
import Dexie, { EntityTable, Table } from "dexie";
const VERSION = 4.1;
export class MySubClassedDexie extends Dexie {
playlists!: EntityTable<Playlist, "id">;
constructor() {
super("myDatabase");
this.version(VERSION).stores({
playlists: "++id,*competitionIds",
});
}
}
export const db = new MySubClassedDexie();
export const defaultPlaylists: Playlist[] = [
{
id: 1,
competitionIds: [3, 4],
title: "The Trial",
},
{
id: 2,
competitionIds: [1, 2],
title: "Confederations Cup",
},
];
db.on("populate", async () => {
await db.playlists.bulkAdd(defaultPlaylists);
});
export interface Playlist {
competitionIds: CompetitionId[];
title: string;
id: number;
}
Reactions are currently unavailable