Skip to content

Help needed with blocks #37631

Answered by Lovor01
Lovor01 asked this question in Q&A
Discussion options

You must be logged in to vote

I succeeded. In a nutshell, I registered custom Entity, as interface to REST API with addEntities and provided custom rest points to save data in a custom MySQL table. Handling of data (saving and deleting) from custom table is in parent block which has innerBlocks and wrapped in useEffect (because it is really a side-effect) and it triggers on saving a parent block in editor.

For the metadata, all is handled in innerBlocks - I used useDebounce hook to save metadata, since I observed entering gets laggy if saving of metadata is not debounced.

Finally, a very tricky part was detecting of innerBlock removal - removing of metadata is in useEffect cleanup function, but [attributes.id] is give…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Lovor01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant