You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is triggering fine when adding or updating comments and replies (effectively add with parentId), but not with delete. It seems like the node is removed from the editor value but the comment remains in the store. Running getCommentNodesByID() in the deleted comment ID returns an empty array as you'd expect.
I have been through the CommentsPlugin source but I'm struggling to get my head around where this should be happening.
The expected behaviour would be to also remove the comment from the store when deleting if I'm not mistaken?
Reproduction URL
No response
Reproduction steps
1. Render a Plate Editor
2. Create a comment
3. Delete a comment
4. Inspect the Plate comment store.
Plate version
39.2.4
Slate React version
0.110.1
Screenshots
No response
Logs
No response
Browsers
No response
The text was updated successfully, but these errors were encountered:
The onClick event is either removing the node editor OR removing the comment from the store depending on whether the comment is active or not. Not sure what the intention is here but to me it's counter-intuitive, I would expect a delete action to perform both, regardless of whether the comment is active or not:
onClick: ()=>{if(activeCommentId===id){// Removes the comment nodes from the editor.unsetCommentNodesById(editor,{ id })setOption("activeCommentId",null)}else{// Removes the comment from the comments store.api.comment.removeComment(id)}onCommentDelete?.(id)},
Proposed change to onClick:
onClick: ()=>{// Always clean up both nodes and storeunsetCommentNodesById(editor,{ id })api.comment.removeComment(id)// Reset active comment if this was the active oneif(activeCommentId===id){setOption("activeCommentId",null)}onCommentDelete?.(id)},
I'll not submit a PR for now as there may be intended behaviour that I've missed.
Description
I'm monitoring the editor comments state with:
This is triggering fine when adding or updating comments and replies (effectively add with parentId), but not with delete. It seems like the node is removed from the editor value but the comment remains in the store. Running getCommentNodesByID() in the deleted comment ID returns an empty array as you'd expect.
I have been through the CommentsPlugin source but I'm struggling to get my head around where this should be happening.
The expected behaviour would be to also remove the comment from the store when deleting if I'm not mistaken?
Reproduction URL
No response
Reproduction steps
Plate version
39.2.4
Slate React version
0.110.1
Screenshots
No response
Logs
No response
Browsers
No response
The text was updated successfully, but these errors were encountered: