wagtail-deprecated / wagtail-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/
BSD 3-Clause "New" or "Revised" License
74 stars 23 forks source link

Block id changes for every page save for block in stream field #34

Closed dniegel closed 5 years ago

dniegel commented 5 years ago

Hi, i noticed this behavior: Every block inside a stream field on a page is saved with a new id when the page is saved (with or without changes on the page or in the blocks). This also seems to happen when copying a page. "Regular" wagtail functionality (Wagtail 2.3 and 2.4) leaves a block id untouched after it was created in the same case.

I'm yet unsure if this functionality change might be on purpose or if it might be a bug? Found this while trying to compare block contents via block id after a page was copied.

Versions: Wagtail 2.3 + wagtail-react-streamfield 0.9.0 Wagtail 2.3 + wagtail-react-streamfield 1.1.1 Wagtail 2.4 + wagtail-react-streamfield 1.1.1

Steps to reproduce:

1) Create a page with a StreamField and a CharBlock inside like

class TestPage(Page):
    body = StreamField([
        ('text', blocks.CharBlock()),
    ], null=True, blank=True)

    content_panels = Page.content_panels + [
        StreamFieldPanel('body'),
    ]

2) Create one "text" block and save the page

3) Save the page again

4) Compare the content_json for the page revisions created in 2) and 3) - the block ids of "text" should differ

ChristophTr commented 5 years ago

I have the same issue. Would be great if this could be fixed.

BertrandBordage commented 5 years ago

Fixed by https://github.com/wagtail/wagtail/pull/4942/commits/ce5604311c15327cb12b35dd4fae311c30c70cc0. Will be released in a new wagtail-react-streamfield version today.

felixschul commented 5 years ago

Hi @BertrandBordage,

Thanks for the fix. When can we expect a release with this fix?

Thanks for your efforts!

Felix

BertrandBordage commented 5 years ago

@felixschul we had a small change of plan, a talented front-end developer is now contributing to react-streamfield (https://github.com/noripyt/react-streamfield/pull/6) to fix the last code quality issues found by Thibaud Colas. I was waiting for his review to do a final high quality react-streamfield 1.0 release. He almost finished his contribution, so I will include his work and release react-streamfield 1.0 and a new version of wagtail-react-streamfield normally this week-end :)

felixschul commented 5 years ago

@BertrandBordage Great to hear, thanks for the update! I am looking forward to the release. Thanks for the good work and your efforts, they are appreciated! :)

BertrandBordage commented 5 years ago

Released in version 1.2.0.