Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Broken instance of custom procedures with multiple parameters #1815

Closed
picklesrus opened this issue Apr 22, 2018 · 5 comments
Closed

Broken instance of custom procedures with multiple parameters #1815

picklesrus opened this issue Apr 22, 2018 · 5 comments
Labels
component: functions issue: bug Describes why the code or behaviour is wrong

Comments

@picklesrus
Copy link
Contributor

picklesrus commented Apr 22, 2018

Problem statement

I managed to break functions pretty badly this morning. Unfortunately I don't have time to look into this much further right now and don't remember my exact repro steps. It mostly involved doing normal things to add parameters to a custom procedure. I did it on the live playground which a believe has release from Friday.

Here's the JS error in the console:

Uncaught TypeError: Cannot read property 'name' of null
    at Blockly.BlockSvg.mutationToDom (procedures.js:133)
    at Object.Blockly.Procedures.mutateCallers (procedures.js:281)
    at Blockly.BlockSvg.compose (procedures.js:225)
    at Blockly.Mutator.workspaceChanged_ (mutator.js:339)
    at Blockly.WorkspaceSvg.Blockly.Workspace.fireChangeListener (workspace.js:436)
    at Blockly.Events.fireNow_ (events.js:160)
5procedures.js:133 Uncaught TypeError: Cannot read property 'name' of null
    at Blockly.BlockSvg.mutationToDom (procedures.js:133)
    at Blockly.Mutator.workspaceChanged_ (mutator.js:333)
    at Blockly.WorkspaceSvg.Blockly.Workspace.fireChangeListener (workspace.js:436)
    at Blockly.Events.fireNow_ (events.js:160)
variable_map.js:391 Uncaught TypeError: Cannot read property 'getId' of null
    at Blockly.VariableMap.getVariableUsesById (variable_map.js:391)
    at Blockly.VariableMap.deleteVariableById (variable_map.js:228)
    at Blockly.WorkspaceSvg.Blockly.Workspace.deleteVariableById (workspace.js:246)
    at Blockly.WorkspaceSvg.deleteVariableById (workspace_svg.js:985)
    at Blockly.FieldTextInput.deleteIntermediateVars_ [as onFinishEditing_] (procedures.js:544)
    at Blockly.FieldTextInput.maybeSaveEdit_ (field_textinput.js:383)
    at Object.dispose_ (field_textinput.js:356)
    at Object.Blockly.WidgetDiv.hide (widgetdiv.js:102)
    at Object.Blockly.hideChaff (blockly.js:302)
    at Blockly.TouchGesture.Blockly.Gesture.doStart (gesture.js:496)
workspace_svg.js:1917 tried to start the same gesture twice
Blockly.WorkspaceSvg.getGesture @ workspace_svg.js:1917
procedures.js:133 Uncaught TypeError: Cannot read property 'name' of null
    at Blockly.BlockSvg.mutationToDom (procedures.js:133)
    at Object.Blockly.Procedures.mutateCallers (procedures.js:281)
    at Blockly.BlockSvg.decompose (procedures.js:201)
    at Blockly.Mutator.setVisible (mutator.js:260)
    at Blockly.Mutator.Blockly.Icon.iconClick_ (icon.js:130)
    at Blockly.Mutator.iconClick_ (mutator.js:113)
    at SVGGElement.wrapFunc (blockly.js:451)

Here's what the block looks like: Note how it has a ',' after the "abcd" like there should be another.. but there isn't one and how when I open the mutator again, I can't edit anything:

screen shot 2018-04-22 at 8 43 16 am

screen shot 2018-04-22 at 8 43 32 am

I also noticed the toolbox had every iteration of typing the word "pizza" as a variable name. I'm guessing that's a side effect from the js error... but noting it just in case. Here's what the variables category looks like:
screen shot 2018-04-22 at 8 46 55 am

@AnmAtAnm AnmAtAnm added issue: bug Describes why the code or behaviour is wrong affects: master component: functions labels Apr 23, 2018
@picklesrus
Copy link
Contributor Author

I haven't been able to reproduce this again. Unfortunately I had to restart chrome so I've now lost the tab it was in too. I did manage to diff the procedures.js file I had loaded in the broken state and the one I get now and they were the same.

@crockwave
Copy link

crockwave commented May 9, 2018

I observed the "tried to start the same gesture twice" and the "Trying to end a gesture recursively" console logging, along with non-responsive toolbar behavior. I had just created a validator function for one of the blocks, which affected the entire workspace. Removing the call to the validator function returned operation back to normal. Found that there was an undefined var reference in the javascript function.

@rachel-fenichel
Copy link
Collaborator

Can you paste your validator function here so we can debug?

@crockwave
Copy link

The validator function below had a typo in the if statement, where regexpsubdomain was misspelled and became undefined, which caused this issue. Chrome debugging didn't expose the cause of the issue, but IE 11 debugging did. The validator function was referenced in an appendDummyInput section of a Block definition
...
this.appendDummyInput()
.appendField("Host: ")
.appendField(new Blockly.FieldTextInput("",validate_Subdomain), "Host");
...

function validate_Subdomain(text) {
var regexpsubdomain = /^([a-zA-Z0-9][a-zA-Z0-9-].)[a-zA-Z0-9]*[a-zA-Z0-9-]*[[a-zA-Z0-9]+$/i;
if (regexpsubdomain.test(text)) {
return text;
} else {
return null;
}
}

@rachel-fenichel
Copy link
Collaborator

Original issue is not reproducible.

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

No branches or pull requests

4 participants