fix: make node wasm loading work
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 2m32s

This commit is contained in:
2025-11-26 12:10:25 +01:00
parent 0894141d3e
commit d3a9b3f056
4 changed files with 22 additions and 12 deletions

View File

@@ -37,7 +37,7 @@ export class RemoteNodeRegistry implements NodeRegistry {
constructor(
private url: string,
private cache?: AsyncCache<ArrayBuffer>,
) {}
) { }
async fetchUsers() {
return this.fetchJson(`nodes/users.json`);
@@ -56,17 +56,17 @@ export class RemoteNodeRegistry implements NodeRegistry {
}
private async fetchNodeWasm(nodeId: `${string}/${string}/${string}`) {
const cachedNode = this.cache?.get(nodeId);
if(cachedNode){
const cachedNode = await this.cache?.get(nodeId);
if (cachedNode) {
return cachedNode;
}
const node = this.fetchArrayBuffer(`nodes/${nodeId}.wasm`);
if (node) {
return node;
const node = await this.fetchArrayBuffer(`nodes/${nodeId}.wasm`);
if (!node) {
throw new Error(`Failed to load node wasm ${nodeId}`);
}
throw new Error(`Failed to load node wasm ${nodeId}`);
return node;
}
async load(nodeIds: `${string}/${string}/${string}`[]) {