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

wagtail-react-streamfield breaks PageChooserPanel / PageChooserBlock

ZackPlauche opened this issue · comments

A few of us in the Wagtail Slack Group are having the same issue where the PageChooserPanel / Block does nothing upon click in admin.

This is a major issue because THIS ALSO HAPPENS WHEN CHOOSING THE ROOT PAGE FOR YOUR WEBSITE, and of course it doesn't work on any other pages inside the admin.

The PageChooserPanel works as soon as 'wagtail_react_streamfield' is removed from INSTALLED_APPS and in Chrome you do a "clear cache and hard reload".

When wagtail-react-streamfield is installed, after a while there's a JavaScript error that occurs every time you try to click "CHOOSE A PAGE".

2021-02-18_12-19-20

Temporary fix:

Use URLField and FieldPanel instead of ForeignKey('wagtailcore.Page', ...) and PageChooserPanel until this is resolved.

And if you need to set a Root Page, remove wagtail_react_streamfield and "clear cache and hard reload" by opening your dev tools in your browser (at least in Chrome), right clicking on the refresh icon, and choosing that option.

Actually this is a problem with all choosers. This package overwrites the page-chooser.js, image-chooser.js, document-chooser.js and snippet-chooser.js files from Wagtail.

But with the release of Wagtail 2.11, the original files have changed, so the package does not work properly. If you have react-streamfield before the default wagtail packages in your INSTALLED_APPS setting, then there are no errors but the choosers are not working properly - obviously since in that case the original chooser js files will be copied into the static folder.

@roodie for me the ImageChooser still works.

@roodie for me the ImageChooser still works.

In streamfield blocks? The selection itself worked for us also, but after saving the page the previously selected item is missing. The ID is saved properly, just the representation (the thumbnail in the case of images, the title in the case of pages) is not there.

@roodie for me the ImageChooser still works.

In streamfield blocks? The selection itself worked for us also, but after saving the page the previously selected item is missing. The ID is saved properly, just the representation (the thumbnail in the case of images, the title in the case of pages) is not there.

@roodie Yeah, for me the image is there in a block inside my main streamblock. Even more so, it's in a listblock in a streamblock in a structblock in a streamblock lol.

Maybe try clearing cache?

Cache clearing did not solve it, we tried everything :-) It probably has to do with different Wagtail versions and the actual usage.

@roodie Hmm, I'm on the Wagtail 2.12.1 and the only extension I have for wagtail is wagtail-react-streamfield.

We are having similar problems with PageChooserBlocks on wagtail 2.12 (ImageChoosers seem to still be working for us).
Looking through wagtail, it looks like there was a change in the createPageChooser function signature between 2.11 and 2.12.

2.11

function createPageChooser(id, pageTypes, openAtParentId, canChooseRoot, userPerms) { ... }

https://github.com/wagtail/wagtail/blob/v2.11.5/wagtail/admin/static_src/wagtailadmin/js/page-chooser.js#L1

2.12

function createPageChooser(id, openAtParentId, options) { ... }

https://github.com/wagtail/wagtail/blob/v2.12.1/client/src/entrypoints/admin/page-chooser.js#L3


With the major issue being that pageTypes has now been moved into options.model_names (this is where the join error is coming from)

For now we have gotten around it by creating our own static/wagtailadmin/js/page-chooser.js that handles the new signature but that is obviously not ideal.

@roodie for me the ImageChooser still works.

In streamfield blocks? The selection itself worked for us also, but after saving the page the previously selected item is missing. The ID is saved properly, just the representation (the thumbnail in the case of images, the title in the case of pages) is not there.

Actually I just ran into this issue. The set image didn't appear on reload.