refactor: prevent duplicate preload
This commit is contained in:
@ -42,8 +42,11 @@ export abstract class FeedCache<TCached> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async preload() {
|
async preload() {
|
||||||
const keys = (await this.table?.toCollection().primaryKeys()) ?? [];
|
// assume already preloaded if keys exist on table in memory
|
||||||
this.onTable = new Set<string>(keys.map(a => a as string));
|
if (this.onTable.size === 0) {
|
||||||
|
const keys = (await this.table?.toCollection().primaryKeys()) ?? [];
|
||||||
|
this.onTable = new Set<string>(keys.map(a => a as string));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
keysOnTable() {
|
keysOnTable() {
|
||||||
|
Reference in New Issue
Block a user