Managing data in custom decorator node #4638
-
|
Hi everyone, I created a custom node extended from decorator node, the goal is pretty simple, a table with 2 columns and a customizable number of rows (at least 2) for this purpose I created the following ` constructor ... So in this case it is called MetadataNode and the two mandatory rows are project and author after that you have a plus button at the bottom of the table, similar to Lexical existing Table and a delete Icon inside each customField row, so everything is working just fine except the delete function. Initial state: projectLabel | projectValue if I click on second custom field (index 1 inside the array), to delete it: projectLabel | projectValue I end up with: projectLabel | projectValue But i can tell that I click on index 1 since my delete function is like this: } and if I extract my data to save it in my database, I can see every customFields but custom 1, as well as custom 3 containing empty LexicalEditor but still present. This should be pretty close from experimental table and its rows/columns behavior but I am guessing I am missing something, so I maybe someone here would have a clue ? Thank you for you time. edit: Code insertion seems wrong everything inside back ticks is suppose to be code of course. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
|
Blindly guessing here, since I need to see more code, but if you have state inconsistency after object mutation, one thing to check is if in your methods where you mutate the state, you are using |
Beta Was this translation helpful? Give feedback.
-
|
Sorry, don't know how I can help further on this one. Good luck with the new component. Let us know how it goes! |
Beta Was this translation helpful? Give feedback.
-
|
posterity post: So that's that. |
Beta Was this translation helpful? Give feedback.
posterity post:
Found my problem, inside decorate function I forgot
<suspense><suspense>so component would fail rendering I guess.Now
updateDom() return falseas it should and I don't see any issue other than that.So that's that.