microsoft / pxt-arcade

Arcade game editor based on Microsoft MakeCode
https://arcade.makecode.com
MIT License
484 stars 210 forks source link

Temporary assets do not appear in asset editor after changing the color palette in Horse Race game #5650

Open kimprice opened 1 year ago

kimprice commented 1 year ago

To Reproduce Steps to reproduce the behavior:

  1. Go to https://arcade.makecode.com/
  2. Scroll down to Multiplayer Games, click on "Horse Race" and then "Open in Editor"
  3. Go to the Asset Editor and click on "Colors"
  4. Change the color palette and click "Apply"
  5. See the temporary assets no longer appear in the Asset Editor

Screenshots tempAssets2

Additional context I have not been able to reproduce this behavior in other projects. There might be some incompatibility/conflict with the added extensions in the "Horse Race" game.

kimprice commented 1 year ago

Worked through this race condition with Richard for quite a while yesterday. What's happening is that after hitting "apply" we reload the header to update the palette and then we go back to the asset editor view - but in this case, the headers aren't finished loading by the time the asset editor is open and therefore the temporary assets don't appear.

We tried adding a listener such that when the blocks project DOM is finished updating, the assets gallery will update the user assets, but it didn't fix the problem. The fields still were not being initialized.

Going forward, we will likely need to implement a data subscribe for the palette instead of calling reload header and then opening the asset editor. This approach would also close this issue of flashing to the blocks editor and back to the asset editor: https://github.com/microsoft/pxt-arcade/issues/5496