Skip to content

Commit

Permalink
Merge pull request #6415 from mozilla/default-to-empty-if-scene-load-…
Browse files Browse the repository at this point in the history
…fails

Default to empty if scene load fails
  • Loading branch information
keianhzo authored Dec 13, 2023
2 parents 31b1f50 + 08c70ce commit d999855
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/hub.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,15 @@ export async function getSceneUrlForHub(hub) {
sceneUrl = document.querySelector("a-scene").is("entered") ? sceneUrl : loadingEnvironment;
} else if (isLegacyBundle) {
// Deprecated
const res = await fetch(sceneUrl);
const data = await res.json();
const baseURL = new URL(THREE.LoaderUtils.extractUrlBase(sceneUrl), window.location.href);
sceneUrl = new URL(data.assets[0].src, baseURL).href;
try {
const res = await fetch(sceneUrl);
const data = await res.json();
const baseURL = new URL(THREE.LoaderUtils.extractUrlBase(sceneUrl), window.location.href);
sceneUrl = new URL(data.assets[0].src, baseURL).href;
} catch (e) {
sceneUrl = loadingEnvironment;
console.error("Error fetching the scene: ", e);
}
} else {
sceneUrl = proxiedUrlFor(sceneUrl);
}
Expand Down

0 comments on commit d999855

Please sign in to comment.