-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Check for duplicates
- I have searched for similar issues before opening a new one.
Description
When using a rendered workspace that mirrors events into a unrendered workspace, pasting blocks that were copied from another function can result in data loss. Specifically, the original copied block disappears.
This seems to occur because the copied block retains its original ID, which exists in both workspaces. Upon pasting, the mirrored event overwrites the block in the hidden workspace due to the ID collision.
I can work around the issue by overriding toCopyData() and setting saveIds: false during block serialization, which prevents ID collisions. (code-dot-org/code-dot-org#67021)
We're using a plugin setup that includes:
- cross-tab plugin
- shareable procedures
We have the following workspaces
- main student workspace
- hidden procedures workspace
- function editor workspace (with event mirroring to hidden workspace)
I am wondering whether Blockly has a clear reason for including block ids in copied blocks or whether they could or should be excluded.
Reproduction steps
Create two functions at https://studio.code.org/projects/spritelab, then:
- In the function editor workspace, copy a block.
- Switch to a different function.
- Paste the copied block.
- Observe that the original block disappears from the hidden workspace.
Stack trace
Screenshots
No response
Browsers
No response