mit-cml/blockly-plugins

You have to click outside the block to get warning indicator removed after variable rename

mark-friedman opened this issue · 4 comments

You shouldn't have to do that. I think that you don't have that behavior in App Inventor, so the bug was introduced when adapting the code for the plugin.

Here's a little video showing the behavior. Note that the warning indicators don't go away until I click outside the variable name field.

Screen.Recording.2023-05-11.at.2.25.13.PM.mov

Note further, that there shouldn't be any warning indicators at all in this case.

Dug into this this morning! Sorry it took me so long to investigate. I think the difference between this an App Inventor is probably related to how App Inventor handles setting field values differently.

So what's happing is that the lexical variable field's validator is triggering the warning check, but the validator runs before the field's value is actually set. So at the time it checks for warnings, name2 is actually incorrect, because the value of the field is still name.

To solve this I think you can just remove the validator! You're already checking for warnings on every event, so no need to do it an extra time for these fields.

Thank you so much, @BeksOmega! I'll check it out asap.