Update asset live query to use bulkGet to fix crash on private browsing Firefox
This commit is contained in:
parent
3aace97004
commit
fdefd907e3
@ -160,7 +160,7 @@ export function AssetURLsProvider({ children }) {
|
||||
|
||||
// Get the new assets whenever the keys change
|
||||
const assets = useLiveQuery(
|
||||
() => database?.table("assets").where("id").anyOf(assetKeys).toArray(),
|
||||
() => database?.table("assets").bulkGet(assetKeys),
|
||||
[database, assetKeys]
|
||||
);
|
||||
|
||||
@ -169,13 +169,14 @@ export function AssetURLsProvider({ children }) {
|
||||
if (!assets || assets.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Assets are about to be loaded so clear the keys to load
|
||||
setAssetKeys([]);
|
||||
|
||||
setAssetURLs((prevURLs) => {
|
||||
let newURLs = { ...prevURLs };
|
||||
for (let asset of assets) {
|
||||
if (newURLs[asset.id]?.url === null) {
|
||||
if (asset && newURLs[asset.id]?.url === null) {
|
||||
newURLs[asset.id] = {
|
||||
...newURLs[asset.id],
|
||||
url: URL.createObjectURL(
|
||||
|
Loading…
Reference in New Issue
Block a user