diff --git a/src/message-dispatch.js b/src/message-dispatch.js index e75cb2266b..ae962808da 100644 --- a/src/message-dispatch.js +++ b/src/message-dispatch.js @@ -262,15 +262,15 @@ export default class MessageDispatch extends EventTarget { break; case "load": { - if (this.hubChannel.can("pin_objects") && this.hubChannel.signIn) { + if (this.hubChannel.can("pin_objects")) { loadState(this.hubChannel, APP.world, args); } } break; case "clear": { - if (this.hubChannel.can("pin_objects") && this.hubChannel.signIn) { - clearState(this.hubChannel, APP.world); + if (this.hubChannel.can("pin_objects")) { + clearState(APP.world); } } break; diff --git a/src/utils/entity-state-utils.ts b/src/utils/entity-state-utils.ts index 105233629d..0425586890 100644 --- a/src/utils/entity-state-utils.ts +++ b/src/utils/entity-state-utils.ts @@ -239,10 +239,10 @@ const TEST_ASSET_STATE = "https://raw.githubusercontent.com/mozilla/hubs-sample-assets/main/Hubs%20Components/test_json/__NAME__"; export async function loadState(hubChannel: HubChannel, world: HubsWorld, state: string) { - clearState(world, hubChannel); + clearState(world); const stateUrl = TEST_ASSET_STATE.replace("__NAME__", state); - console.log(stateUrl); + const resp = await fetch(stateUrl); const entityStates: EntityStateList = await resp.json(); entityStates.data.forEach(entityState => { @@ -251,7 +251,7 @@ export async function loadState(hubChannel: HubChannel, world: HubsWorld, state: }); } -export function clearState(world: HubsWorld, hubChannel: HubChannel) { +export function clearState(world: HubsWorld) { networkedQuery(world).forEach(eid => { if (isNetworkInstantiated(eid) && isPinned(eid)) { deleteTheDeletableAncestor(world, eid);