Block comments should not be owned by the icon in a rendered workspace
See original GitHub issueProblem statement
On a rendered workspace the icon for opening the comment also owns the text for that comment. This means the block model depends on the rendered icon for information about the comment text (and position). This information should be independent of the icon so that it isn’t lost when loaded/saved in a headless workspace.
Expected Behavior
- Comment data is preserved in headless workspaces.
- There should not be any special cases for serializing comments.
Actual Behavior
- Only the text is preserved in a headless workspace.
- We have to special case delete events to avoid losing the comment when its icon is destroyed.
Steps to Reproduce
See discussion in #1960
Stack Traces
Replace with error stack trace.
Operating System and Browser
Additional Information
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Issue #1554 · LLK/scratch-blocks - Comments ToDo - GitHub
Block comments render too far away from blocks in wide stacks. Workspace does not scroll with block comments (e.g. if a block comment...
Read more >Commenting in Workspaces and Versions - Onshape
Comments are not recorded in the workspace history. Tap the Comments icon to open and close the comment flyout.
Read more >Comment Anchors - Visual Studio Marketplace
Extension for Visual Studio Code - Place anchor tags within comments for easy file and workspace navigation.
Read more >August 11, 2022 – Comment reactions, progress bars & more
React to comments with emojis, visualize your number properties as progress bars, set default templates for databases, and much more.
Read more >Blockly - WorkspaceSvg - Google Developers
Unlink from all DOM elements to prevent memory leaks. Find all blocks in workspace. Blocks are optionally sorted by position; top to bottom...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So it looks like block_svg is essentially doing that. If the comment text is set to null it deletes the icon and any string object (including empty string) creates the icon if it doesn’t already exist.
Regarding events, it looks like the event setting the comment text to ‘’ is a side effect and the addition/removal of the comment isn’t actually captured in events right now (if you add a comment then remove it without adding any text you won’t see any events). I think adding a comment should fire an event setting the event text to ‘’ and removing a comment should fire an event setting it to null.
Whether we serialize empty comments is a separate question. It looks like we currently don’t, which I’m fine with.
Fixed by #2923