Skip to content

Commit fa7868f

Browse files
fehnomenaltoddeTV
andauthored
fix: prevent duplicate parsing of the same model (#39)
Co-authored-by: Thorsten Seyschab <business@todde.tv>
1 parent 500dd0c commit fa7868f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/core/generate/templates/runtime.hbs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ export const {{name}} = {
2323
return {{identifiers.nodeName}};
2424
}
2525

26-
async function loadModel() {
27-
return await gltfLoader.loadAsync(gltfPath);
26+
let modelPromise;
27+
28+
function loadModel() {
29+
if (!modelPromise) {
30+
modelPromise = gltfLoader.loadAsync(gltfPath);
31+
}
32+
33+
return modelPromise;
2834
}

0 commit comments

Comments
 (0)