Skip to content

fix(viewpoints): throw a clear error when go() has no world - #843

Open
helenkwok wants to merge 1 commit into
ThatOpen:mainfrom
helenkwok:fix/viewpoint-go-without-world
Open

helenkwok wants to merge 1 commit into
ThatOpen:mainfrom
helenkwok:fix/viewpoint-go-without-world

Conversation

@helenkwok

Copy link
Copy Markdown
Contributor

Fixes #842.

Viewpoint.go() now throws when the viewpoint has no world, with a message that says to set world on the viewpoint or Viewpoints.world before creating or loading viewpoints (for example with BCFTopics.load). This matches the existing error a few lines below for a camera that is not an OrthoPerspectiveCamera, and is added to the method's @throws docs.

updateCamera() and takeSnapshot() are unchanged: they already tell the caller by resolving false.

Test: src/core/Viewpoints/viewpoint-go.test.ts creates a viewpoint while Viewpoints.world is null and expects go() to reject. It fails on main ("promise resolved undefined instead of rejecting") and passes with this change. eslint is clean on both files.

Behaviour change to note: code that called go() on a viewpoint without a world and relied on it doing nothing will now get a rejected promise.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Viewpoint.go() does nothing, silently, when the viewpoint has no world

1 participant