Closed roelio closed 6 years ago
Hum… That’s actually a design decision before being a code issue. I’m not sure that’s a good idea to put a StructBlock as a StructBlock field. I never thought about doing it in any site, I don’t find it clear for UX reasons (though I agree it can make sense in terms of data structure). Let me discuss that with the rest of the Wagtail team during today’s meeting.
For the record, there is only one mention in the whole Wagtail project of a StructBlock as a StructBlock field: https://github.com/wagtail/wagtail/blob/master/wagtail/core/tests/test_blocks.py#L2990-L3004 And it’s not to test whether it’s good or not, it’s to test that block names shouldn’t include spaces.
The example you give in the test file looks like a valid use case for the Struct in Struct definition. Or would it be better for example to have a list block in that case with a structblock as child with the fields orientation
(choiceblock), heading
and rich text
?
Good luck with the meeting and thanks again for your quick response!
It was decided that StructBlock as a StructBlock field is a valid use case!
Fixed by fc8140df538be004d5cd41ae2799aeb0a25331cd.
Fix released in wagtail-react-streamfield 0.8.2 and improved in 0.8.3.
An issue arose when I have a
StructBlock
inside aStructBlock
.Check out my example "Nested struct block" at https://roelio.github.io/react-streamfield/example/ you can see that the inner struct block is handles as a list.