wagtail-deprecated / react-streamfield

Powerful field for inserting multiple blocks with nesting. (NO LONGER MAINTAINED - See Wagtail 2.13 Release Notes)
https://wagtail.github.io/react-streamfield/public/
35 stars 12 forks source link

Issue with nested StructBlock #1

Closed roelio closed 6 years ago

roelio commented 6 years ago

An issue arose when I have a StructBlock inside a StructBlock.

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.

BertrandBordage commented 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.

roelio commented 6 years ago

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!

BertrandBordage commented 6 years ago

It was decided that StructBlock as a StructBlock field is a valid use case!

BertrandBordage commented 6 years ago

Fixed by fc8140df538be004d5cd41ae2799aeb0a25331cd.

BertrandBordage commented 6 years ago

Fix released in wagtail-react-streamfield 0.8.2 and improved in 0.8.3.