fix a couple of block rendering bugs#10602
Conversation
| block.setDisabledReason(false, Blockly.constants.MANUALLY_DISABLED); | ||
|
|
||
| // this is the reason for blocks that are disabled via Blockly.Events.disableOrphans | ||
| block.setDisabledReason(false, "ORPHANED_BLOCK"); |
There was a problem hiding this comment.
Why is it that we can have all of these calls without conditions?
There was a problem hiding this comment.
this is a no-op if the block isn't disabled
|
|
||
| } | ||
|
|
||
| const DIFF_DISABLED_REASON = "disabled_for_diff"; |
There was a problem hiding this comment.
Would it be better to have these consts somewhere consistent? Like if we were to add more reasons why the blocks are disabled, would it be better to have it in one place rather than in the different files or are these the only scenarios blocks can be disabled?
There was a problem hiding this comment.
this workspace is only being used to generate the diff SVG for the github integration. it gets thrown away after the diff is rendered. only reason we have this reason here is because we need some string to pass to setDisabledReason (but it could be any random string)
fixes microsoft/pxt-microbit#6147
fixes microsoft/pxt-microbit#6242
fixes two unrelated rendering bugs for blocks
the first bug was because we weren't listening to the path changes correctly inside of PathObject. I corrected that by overriding setPath and removed our old hack for fixing highlights manually in blocks.tsx
the second bug was caused by blockly deprecating the setEnabled function on blocks. blocks can now be disabled for multiple reasons, and we weren't clearing all of those reasons when we updated the disabled blocks on the workspace. in particular, the disabling caused by Blockly.Events.disableOrphans() (which we call in blocks.tsx) was sometimes sticking around. i fixed this and removed all calls to the deprecated function