blockly-samples
blockly-samples copied to clipboard
shadow-block-converter throws exception on undo/redo
Check for duplicates
- [ ] I have searched for similar issues before opening a new one.
Component
shadow-block-converter
Description
throws error when undoing. the actual UI state seems correct though. the error is because the shadow block doesn't exist in the workspace at the time the event is trying to look it up by id.
Reproduction steps
- Drag the "print example text 1/2" block.
- Modify the "example text 2" shadow block so it turns into a real block
- Ctrl z
- Note the error in the console
- Despite the error, undoing appears to work. But redo does not work.
The error is not thrown for the "reverse abc" block.
Stack trace
Uncaught Error: The associated block is undefined. Either pass a block to the constructor, or call fromJson
at BlockChange$$module$build$src$core$events$events_block_change.run (events_block_change.ts:173:17)
at WorkspaceSvg$$module$build$src$core$workspace_svg.undo (workspace.ts:735:15)
at Object.callback (shortcut_items.ts:263:17)
at ShortcutRegistry$$module$build$src$core$shortcut_registry.onKeyDown (shortcut_registry.ts:263:18)
at onKeyDown$$module$build$src$core$inject (inject.ts:318:29)
at HTMLDivElement.f (browser_events.ts:69:9)Understand this error
Screenshots
No response