Skip to content

Commit

Permalink
Improve all objects loaded heuristic
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Oct 6, 2021
1 parent b4525c4 commit 2b58d1d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/react-components/room/useRoomLoadingState.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,13 @@ export function useRoomLoadingState(sceneEl) {
// TODO: Determine a better way to ensure the object dependency chain has resolved, or switch to a
// progressive loading model where all objects don't have to be loaded to enter the room.
loadingTimeoutRef.current = setTimeout(() => {
dispatch({ type: "all-objects-loaded" });
// Send the objects loaded event if there are no new objects loading after 1.5secs
if (objectCount === loadedCount + 1) {
dispatch({ type: "all-objects-loaded" });
}
}, 1500);
},
[dispatch]
[dispatch, objectCount, loadedCount]
);

const onEnvironmentLoaded = useCallback(
Expand Down

0 comments on commit 2b58d1d

Please sign in to comment.