From abc61d7f0486b6316eb7df1ebae39306b72467a1 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 18 Jul 2023 22:45:52 +0000 Subject: [PATCH] chore: make flyout use render queue explicitly --- core/flyout_base.ts | 10 ++++++++-- tests/mocha/flyout_test.js | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/core/flyout_base.ts b/core/flyout_base.ts index 25fe446e6d7..8940574a658 100644 --- a/core/flyout_base.ts +++ b/core/flyout_base.ts @@ -36,6 +36,7 @@ import * as Variables from './variables.js'; import {WorkspaceSvg} from './workspace_svg.js'; import * as utilsXml from './utils/xml.js'; import * as Xml from './xml.js'; +import * as renderManagement from './render_management.js'; enum FlyoutItemType { BLOCK = 'block', @@ -626,6 +627,8 @@ export abstract class Flyout extends DeleteArea implements IFlyout { const parsedContent = toolbox.convertFlyoutDefToJsonArray(flyoutDef); const flyoutInfo = this.createFlyoutInfo(parsedContent); + renderManagement.triggerQueuedRenders(); + this.layout_(flyoutInfo.contents, flyoutInfo.gaps); if (this.horizontalLayout) { @@ -770,7 +773,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { ) as Element; block = this.getRecycledBlock(xml.getAttribute('type')!); if (!block) { - block = Xml.domToBlock(xml, this.workspace_); + block = Xml.domToBlockInternal(xml, this.workspace_); } } else { block = this.getRecycledBlock(blockInfo['type']!); @@ -779,7 +782,10 @@ export abstract class Flyout extends DeleteArea implements IFlyout { blockInfo['enabled'] = blockInfo['disabled'] !== 'true' && blockInfo['disabled'] !== true; } - block = blocks.append(blockInfo as blocks.State, this.workspace_); + block = blocks.appendInternal( + blockInfo as blocks.State, + this.workspace_ + ); } } diff --git a/tests/mocha/flyout_test.js b/tests/mocha/flyout_test.js index 0e6686b296e..5594f8e26c0 100644 --- a/tests/mocha/flyout_test.js +++ b/tests/mocha/flyout_test.js @@ -27,7 +27,7 @@ import { suite('Flyout', function () { setup(function () { - sharedTestSetup.call(this); + this.clock = sharedTestSetup.call(this, {fireEventsNow: false}).clock; Blockly.defineBlocksWithJsonArray([ { 'type': 'basic_block', @@ -48,6 +48,7 @@ suite('Flyout', function () { }); teardown(function () { + this.clock.runAll(); sharedTestTeardown.call(this); });