mirror of
https://github.com/google/blockly.git
synced 2026-01-04 15:40:08 +01:00
fix: block initialization (#7777)
* fix: reorganize initialization * chore: fix failing tests * fix: tests * chore: format * chore: remove console trace
This commit is contained in:
@@ -191,6 +191,13 @@ export class Block implements IASTNodeLocation, IDeletable {
|
||||
*/
|
||||
private disposing = false;
|
||||
|
||||
/**
|
||||
* Has this block been fully initialized? E.g. all fields initailized.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
initialized = false;
|
||||
|
||||
private readonly xy_: Coordinate;
|
||||
isInFlyout: boolean;
|
||||
isInMutator: boolean;
|
||||
@@ -373,13 +380,11 @@ export class Block implements IASTNodeLocation, IDeletable {
|
||||
* change).
|
||||
*/
|
||||
initModel() {
|
||||
if (this.initialized) return;
|
||||
for (const input of this.inputList) {
|
||||
for (const field of input.fieldRow) {
|
||||
if (field.initModel) {
|
||||
field.initModel();
|
||||
}
|
||||
}
|
||||
input.initModel();
|
||||
}
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user