Skip to content

Commit 646b8c0

Browse files
gonfunkosebjacobs
authored andcommitted
fix: only refresh the toolbox when procedures are created via undo (scratchfoundation#19)
* fix: only refresh the toolbox when procedures are created via undo * chore: add comment clarifying procedure block creation handling
1 parent e6c437f commit 646b8c0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/containers/blocks.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,12 @@ class Blocks extends React.Component {
148148
event.type === this.ScratchBlocks.Events.VAR_DELETE ||
149149
(event.type === this.ScratchBlocks.Events.BLOCK_DELETE &&
150150
event.oldJson.type === "procedures_definition") ||
151+
// Only refresh the toolbox when procedure block creations are
152+
// triggered by undoing a deletion (implied by recordUndo being
153+
// false on the event).
151154
(event.type === this.ScratchBlocks.Events.BLOCK_CREATE &&
152-
event.json.type === "procedures_definition")
155+
event.json.type === "procedures_definition" &&
156+
!event.recordUndo)
153157
) {
154158
this.requestToolboxUpdate();
155159
}

0 commit comments

Comments
 (0)