Skip to content

Commit

Permalink
chore: make flyout use render queue explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
BeksOmega committed Jul 24, 2023
1 parent 7eb651a commit abc61d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions core/flyout_base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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']!);
Expand All @@ -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_
);
}
}

Expand Down
3 changes: 2 additions & 1 deletion tests/mocha/flyout_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -48,6 +48,7 @@ suite('Flyout', function () {
});

teardown(function () {
this.clock.runAll();
sharedTestTeardown.call(this);
});

Expand Down

0 comments on commit abc61d7

Please sign in to comment.