fix: correctly load nodes from cache/fetch
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 4m9s

This commit is contained in:
2025-11-26 11:09:19 +01:00
parent 925167d9f2
commit 0894141d3e

View File

@@ -56,16 +56,17 @@ export class RemoteNodeRegistry implements NodeRegistry {
} }
private async fetchNodeWasm(nodeId: `${string}/${string}/${string}`) { private async fetchNodeWasm(nodeId: `${string}/${string}/${string}`) {
const res = await Promise.race([ const cachedNode = this.cache?.get(nodeId);
this.fetchArrayBuffer(`nodes/${nodeId}.wasm`), if(cachedNode){
this.cache?.get(nodeId), return cachedNode;
]);
if (!res) {
throw new Error(`Failed to load node wasm ${nodeId}`);
} }
return res; const node = this.fetchArrayBuffer(`nodes/${nodeId}.wasm`);
if (node) {
return node;
}
throw new Error(`Failed to load node wasm ${nodeId}`);
} }
async load(nodeIds: `${string}/${string}/${string}`[]) { async load(nodeIds: `${string}/${string}/${string}`[]) {