Input.prototype.setVisible
should not assume that this.connection
is a RenderedConnection
#8694
Labels
issue: bug
Describes why the code or behaviour is wrong
[Bug report rewritten by @cpcallen.]
The
setVisible
method ofInput
does an unsafe castthis.connection as RenderedConnection
. Instead, the actual type ofthis.connection
should be tested an the method shoud no-op if the connection is not aRenderedConnection
.Original description follows.
Check for duplicates
Description
It is not possible to activate the toolbox search bar and hide a input parameter of a block.
Within the function where my block and its inputfields get initialized i try to hide some inputfields with the method setVisible(false). But unfortunately this will cause an error.
The weird thing about that is, that this bug only occurs when the toolbox search bar is activated.
Reproduction steps
Error occurs during the initialization of a block and its fields.
An example of my code:
Blockly.Blocks['customBlockName'] = {
init: function (this: Blockly.Block) {
this.appendDummyInput().appendField('customBlockName');
/*
bunch of code
.......
......
.....
*/
const inputField: Blockly.Input = this.appendValueInput('inputFieldIdInput').setCheck('String').appendField('inputFieldId')
customAddBlockService.appendshadowBlock()
inputField.setVisible(fallse) // --> This line of code will cuase an error
Stack trace
Screenshots
Browsers
No response
The text was updated successfully, but these errors were encountered: