Map editor tiles are now fully loaded from cache

This commit is contained in:
2025-01-13 10:52:40 +01:00
parent 367d536c52
commit 8f07cf5093
6 changed files with 107 additions and 44 deletions

View File

@ -33,6 +33,16 @@ export class BaseStorage<T extends { id: string }> {
}
}
async getByIds(ids: string[]): Promise<T[]> {
try {
const items = await this.dexie.table(this.tableName).bulkGet(ids)
return items.filter((item) => item !== null)
} catch (error) {
console.error(`Failed to retrieve ${this.tableName} by ids:`, error)
return []
}
}
async getAll(): Promise<T[]> {
try {
return await this.dexie.table(this.tableName).toArray()