fix: block initialization (#7777)

* fix: reorganize initialization

* chore: fix failing tests

* fix: tests

* chore: format

* chore: remove console trace
This commit is contained in:
Beka Westberg
2024-01-18 10:12:57 -08:00
parent 8c5f32b2f9
commit 5db9b5bf11
7 changed files with 43 additions and 22 deletions

View File

@@ -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;
}
/**