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

Phantom or orphaned false blocks created during interaction with if/else-if/else block #5984

Closed
microbit-robert opened this issue Oct 9, 2024 · 3 comments · Fixed by microsoft/pxt#10227
Assignees

Comments

@microbit-robert
Copy link
Contributor

Describe the bug
After adding several else if sections to an if block (at least three), removing them using the - button leaves phantom / orphaned false blocks on the canvas. These can't be interacted with or removed by the user. These also don't appear in the JavaScript.

The following error appears in the developer console:

Uncaught TypeError: Cannot read properties of null (reading 'isShadow')
    at ad.setTargetBlock (main.js:7:230288)
    at ad.setTargetBlock (main.js:7:230304)
    at ad.setStartBlock (main.js:7:230249)
    at ad.handleBlockStart (main.js:7:227938)
    at ep.onMouseDown_ (main.js:7:433042)
    at SVGGElement.o (main.js:7:42156)

The following warning appears in the developer console:

Shadow block of type 'logic_boolean' found at top level. Converting to non-shadow block

To Reproduce
Steps to reproduce the behavior:

  1. Open the microbit-phantom-false-blocks.hex file in the following microbit-phantom-false-blocks.zip file
  2. Click the + button in the if block to add another else if section
  3. Click the - button on the same section just added
  4. Note that there is now a 'phantom' false block hidden behind the every block and observe the errors in the developer console
  5. This can be repeated subsequent times

Please see the gif below if these steps to reproduce aren't clear.

Expected behavior
Phantom false blocks should not be left behind in this way.

Screenshots
Image

micro:bit version (please complete the following information):
Not hardware related

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Chrome 129.0.6668.90

Additional context
None

@riknoll riknoll self-assigned this Oct 9, 2024
@riknoll
Copy link
Member

riknoll commented Oct 9, 2024

minimal repro steps:

Image

you need to have something attached to the first two condition inputs for the third input to exhibit the bug

@microbit-robert
Copy link
Contributor Author

microbit-robert commented Oct 10, 2024

It seems highly likely that this is the cause of top-level shadow blocks noted in this separate fix -> microsoft/pxt#10177

@Jaqster
Copy link
Member

Jaqster commented Oct 10, 2024

Related issue - #5899

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants