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}`) {
const res = await Promise.race([
this.fetchArrayBuffer(`nodes/${nodeId}.wasm`),
this.cache?.get(nodeId),
]);
if (!res) {
throw new Error(`Failed to load node wasm ${nodeId}`);
const cachedNode = this.cache?.get(nodeId);
if(cachedNode){
return cachedNode;
}
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}`[]) {