-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
During domToWorkspace() child block with FieldDropdown is in workspace's topblock #2926
Comments
Thanks for the detailed repro information! This sounds like a change in the initialization order for fields that broke your blocks. It's not a surprise that blocks are on the workspace when created, and are then attached to the expected parent, but your initialization function must be being called early than it used to be. @BeksOmega any ideas before I dig in? |
The only change I can think of (without digging into it) is that dropdown validators are now called on XML values. This problem doesn't seem to involve validators though, so idk :/ |
Hi, My problem is more: in previous version, the root block DURING I also don't know why the function to fill the FieldDropdown is called four time for each child block ? Here are some logs :
|
You wrote the validators are NOW called on dropdown for XML values. Hmmm ... |
If other people faced the problem, little "temporary hack" to solve my problem, temporary (during
|
Possibly fixed. @samelhusseini to confirm. |
Yes, we are no longer calling the validation method in the constructor which was the cause of this issue. However, I've also looked into optimizing the number of times we call the dynamic function generator here: #3036 |
Hi, we tested with the last Blockly, 3.20191014.4, and we still have the problem with dynamic filled dropdowns |
An example to reproduce the problem with dynamic filled dropdown (in function of another dropdown value) |
@samelhusseini , @rachel-fenichel should I open a new issue ? |
I updated blockly in a project from
1.20190419.0
to "npm": "blockly": "2.20190722.1"
In order to restore a view, I use
Blockly.Xml.domToWorkspace(this.contentData.content, this.workspace);
In our project we only have one top/root block (with childs) by design.
Some child blocks have FieldDropdown, which are filled with a function like
with FieldDropdown values depending on what is set in the root block.
With Blockly 1.20190419.0 => OK
But with Blockly 2.20190722.1 after domToWorkspace, I faced the following. Traces in console like:
In the createSelectedDataTableField_func() call, the child block's getRootBlock() is itself O_o
And the workspace has two+ top blocks, the good one and the child(s). So If I call getRootBlock() to do a
let xyz = rootBlock.getFieldValue('SELECTED_TABLE');
call it won't work anymore.
I had to (bad) hack our code with
to select the "good" root block.
Later, I get the Blockly.Events.BLOCK_CREATE event, and the child(s) block(s) are (back) to root block childs => OK
Expected behavior
Like before
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: