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

Logic Comparison block doesn't immediately update when its children change outputs #757

Open
acbart opened this issue Dec 2, 2016 · 4 comments
Labels
issue: bug Describes why the code or behaviour is wrong

Comments

@acbart
Copy link

acbart commented Dec 2, 2016

So, perhaps this is the expected behavior, but I think there's a minor issue with setOutput when it comes to logic_compare blocks.

So say I have a "logic_compare" between a literal number and a variable.

image

And I run some bit of code to change the output type of the variable:

Blockly.mainWorkspace.getAllBlocks()[2].setOutput(true, "Array")

In theory, the blocks should be bounced out of the conditional, since they're both wrong (I'd rather only one bounce out, but this is fine too). This is what happens with simpler checks, e.g., if I change a "variables_get" block inside of a "control_repeat" block (which expects a "Number" output). However, nothing happens UNTIL I click one of the blocks in question, at which time the separation occurs.

I assume this happens because the onchange() function for the "logic_compare" block doesn't get triggered by a setOutput() call. If this is normal behavior, I'd be very interested if there's a way to sanely force this kind of update. I was hoping workspace.render would do it, but it didn't seem to make a difference.

@AnmAtAnm
Copy link
Contributor

AnmAtAnm commented Dec 5, 2016

It looks like setOutput(..), and probably several other methods, do not fire a ChangeEvent. We probably need to, at least when the block has already been added to a workspace. We'll have to be careful not to introduce too many events during block/toolbox/workspace loading, but most (all?) of those change occur before the Block is added anywhere.

@rachel-fenichel rachel-fenichel added the issue: bug Describes why the code or behaviour is wrong label Jan 23, 2017
@MNSDivya
Copy link

Issue still persists

@janhink
Copy link

janhink commented Apr 20, 2023

The issue still persists as of April 2023. Are there any workarounds?

@BeksOmega
Copy link
Collaborator

The issue still persists as of April 2023. Are there any workarounds?

There's no great work around! But when you trigger setOutput or setCheck you could disconnect and reconnect the output connection. This will trigger a change event, which will trigger the logic_compare block to update. I hope that helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Describes why the code or behaviour is wrong
Projects
None yet
Development

No branches or pull requests

6 participants