wagtail-deprecated / wagtail-react-streamfield

Powerful field for inserting multiple blocks with nesting. (NO LONGER MAINTAINED - See Wagtail 2.13 Release Notes)

Home Page:https://wagtail.github.io/react-streamfield/public/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

new changes to stream field content is lost if a validation error occurred while saving

AsankaL opened this issue · comments

I've created a custom ImageGalleryBlock and ImageGalleryItemBlock as follow.

class ImageGalleryBlock(StructBlock):
    image_list = ListBlock(ImageGalleryItemBlock(), label="Image Gallery")
    title = CharBlock(label="Gallery Title")

class ImageGalleryItemBlock(StructBlock):
    image = ImageChooserBlock()
    caption = CharBlock(required=False)

When I try to save and there is validation error in the one of these blocks, react-streamfield crashes.(e.g: trying to save without 'title' for ImageGalleryBlock)
It shows Uncaught TypeError: Cannot read property 'split' of null in console.

I can confirm it, introduced recently by wagtail-deprecated/react-streamfield@d76a986 & wagtail-deprecated/react-streamfield@0ee27e0. I’m working on a fix.