Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix recursion issue in pxt-arcade and gridLiteral comment attribute #10072

Merged
merged 3 commits into from
Aug 7, 2024

Conversation

riknoll
Copy link
Member

@riknoll riknoll commented Aug 5, 2024

This PR contains two small unrelated fixes that I was too lazy to open separately:

  1. Fixes an infinite loop in pxt-arcade caused by my toolbox XML recursion change that I checked in recently
  2. Fixes the gridLiteral comment attribute so that it is correctly marked as a numeric attribute (just like imageLiteral)

Turns out that getElementsByTagName returns a "live" list, so if more shadow blocks were added by the recursive call it would end up making the length of the array longer so that it looped infinitely. I fixed it by using our toArray util to convert it into a static list.

gridLiteral is used for creating blocks that have the matrix field editor (like the show leds block in pxt-microbit). I need it for the CSP robot extension that I'm working on.

@riknoll riknoll requested a review from a team August 5, 2024 23:19
Copy link
Contributor

@thsparks thsparks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't know getElementsByTagName would update on the fly like that. Neat finding...

@riknoll riknoll merged commit 804e35a into master Aug 7, 2024
6 checks passed
@riknoll riknoll deleted the dev/riknoll/fix-grid-literal branch August 7, 2024 17:16
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.

2 participants