phetsims / paper-land

Build and explore multimodal web interactives with pieces of paper!
https://phetsims.github.io/paper-land/
MIT License
10 stars 1 forks source link

Is there a way to refresh the Board page when you send to playground? #223

Closed jessegreenberg closed 3 months ago

jessegreenberg commented 3 months ago

It seems like we are running into problems from the Creator page, especially after an error is thrown on the board, where the board page does not update as we expect it to.

I am wondering if there is a way to request a refresh after you send programs to the playground, so that state is fresh every time you try to run a change.

If not (or in addition to this), lets get the errors handled better so that the board continues to work through problems.

jessegreenberg commented 3 months ago

This was done in the above commit. The tricky part is that the board page needs to wait until after new code is loaded into local storage from the camera page. The camera page updates the code in local storage with polling. If the board page refreshes as soon as code is sent, it will run old code for a few frames and there will still be errors. So there are messages that are sent like this:

creator send -> camera page receives, updates code in local storage, sends message to board -> board refresh occurs

This seems to be working well but I want to test a bit more before merging into main.

jessegreenberg commented 3 months ago

I tested it a bit more and it is working pretty well. This has been merged into main. Closing.