frontend: wait on SplatMesh.initialized instead of an unused instance's onLoad (Sonar S1848)

This commit is contained in:
Dylan M. Taylor committed 2026-11-10 23:51:39 +00:00
1 parent c0e672e5cf
commit 703da969fd
2 files changed
+10 -14

No files matched your search

@@ -1079,15 +1079,10 @@ class Scene {
}
throw error;
}
return new Promise((resolve) => {
new SplatMesh({
fileBytes: buffer,
onLoad: (mesh) => {
resolve(mesh);
onComplete();
},
});
});
const mesh = new SplatMesh({ fileBytes: buffer });
await mesh.initialized;
onComplete();
return mesh;
}
/**
@@ -408,9 +408,8 @@ export function Viewer3D({
if (SPLAT_EXTENSIONS.includes(urlExtension)) {
console.log(`[Viewer3D] splat format detected (.${urlExtension})`);
new SplatMesh({
url: modelUrl,
onLoad: (mesh) => {
void new SplatMesh({ url: modelUrl }).initialized
.then((mesh) => {
if (cancelled) {
mesh.dispose();
return;
@@ -434,8 +433,10 @@ export function Viewer3D({
}
console.log("Splat loaded");
},
});
})
.catch((error) =>
console.error("[Viewer3D] splat load failed:", error),
);
} else if (!GLTF_EXTENSIONS.includes(urlExtension)) {
// Known non-glTF model format with no loader wired here (obj, fbx,
// pmx, …). Show the fallback shape rather than spamming a parse error.