-
-
Notifications
You must be signed in to change notification settings - Fork 742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to delete a linked node? #592
Comments
Same issue. |
@prevwong is deleting linked nodes possible? |
Yes, same issue here. |
I'm having a similar issue. The error thrown is:
|
Same issue. |
PSA the only way I got this to work properly was processing the editor state in my backend every time a change is published, deleting the node there, and then have Craft re-render with the updated state |
thanks @jorgegonzalez! fwiw this is my workaround:
|
@ck6u4dj0 your function deletes linkedNode's parent, which is not what is generally needed. I have a ColumnsBlock component. If the user decreases the number of columns I need to delete the linked nodes that are the extra columns. I do not want (and cannot) delete the ColumnsBlock itself. I find it frustrating that when my ColumnsBlock renders, if it does not render the extra column, that component remains in the editor's state anyway, even though it was never rendered. @prevwong, this is a serious issue. Is there a way to delete linked nodes? edit: I may have solved this similar to @jorgegonzalez, but in the front end. I call |
I'm also struggling with
In my case I want to fetch some data and display it front end as a list of cards. But this card is not something I want to change it's just a graphical representation of the final result. So once I have the response I'm creating
Using the |
Describe the bug
craft json:
{
"ROOT": {
"type": {
"resolvedName": "PageContainer"
},
"isCanvas": true,
"props": {
},
"displayName": "APP",
"hidden": false,
"nodes": [
"dseJuw_N09"
],
"linkedNodes": {}
},
"dseJuw_N09": {
"type": {
"resolvedName": "TabsWrapper"
},
"isCanvas": false,
"props": {
},
"displayName": "Tabs",
"custom": {},
"parent": "ROOT",
"hidden": false,
"nodes": [],
"linkedNodes": {
"simple-tabpanel-0": "4UMnl2CvbA",
"simple-tabpanel-1": "7nsOGA7ixG",
"simple-tabpanel-2": "OQA1r8DNvq"
}
},
"4UMnl2CvbA": {
"type": {
"resolvedName": "Container"
},
"isCanvas": true,
"props": {
},
"displayName": "Container",
"custom": {},
"parent": "dseJuw_N09",
"hidden": false,
"nodes": [],
"linkedNodes": {}
},
"7nsOGA7ixG": {
"type": {
"resolvedName": "Container"
},
"isCanvas": true,
"props": {
},
"displayName": "Container",
"custom": {},
"parent": "dseJuw_N09",
"hidden": true,
"nodes": [],
"linkedNodes": {}
},
"OQA1r8DNvq": {
"type": {
"resolvedName": "Container"
},
"isCanvas": true,
"props": {
},
"displayName": "Container",
"custom": {},
"parent": "dseJuw_N09",
"hidden": true,
"nodes": [],
"linkedNodes": {}
}
}
To Reproduce
Steps to reproduce the behavior:
const { actions } = useEditor()
actions.delete("OQA1r8DNvq")
Error: Invariant failed: Attempting to delete a top-level Node
Expected behavior
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Your environment
The text was updated successfully, but these errors were encountered: