Open SteinRobert opened 10 months ago
Did you delete the image file or the image model? By the looks of the TS file - it should not be able to reach that without a valid ID, this would mean a reference of a model or anything would still exist somewhere. If you deleted the image file itself - I feel that would kindof be out of scope, this isn't how people regularly do it. Could you provide a console log?
Here you go:
I guess something needs to be done here, not? The JS is breaking the whole page editor. The API call for the image returns a 404 which leads to the JS breaking.
Here you go:
I guess something needs to be done here, not? The JS is breaking the whole page editor. The API call for the image returns a 404 which leads to the JS breaking.
Sorry to ask again - did you delete the image file itself, or the model image instance in the database?
Sorry overlooked. As mentioned:
I delete the image as an instance under (/cms/images).
The image model instance was deleted through the wagtail ui.
I can confirm, same behaviour here.
Sorry all, I somehow missed this one. If anyone has the time, a PR will be most welcome
Possibly some sort of DB constraint should be enforced to prevent this somehow? Don't have time either but might be helpful.
Possibly some sort of DB constraint should be enforced to prevent this somehow?
it is complicated. In that you should be able to remove stuff without everything exploding. I think in this case it is to do with localize trying to access properties that are not available for the widget, and it doesn't do that gracefully
The issues is with https://github.com/wagtail/wagtail-localize/blob/caf14b8e276a735f7536d3468762797af5c25315/wagtail_localize/static_src/common/components/ImageChooser/index.tsx#L31 -- which doesn't check for non-20x responses before setting the image info object which is used below (example) to render the preview image
Description
ImageBlock
- an image is chosen.The JS is breaking at this point:
Which is probably this: https://github.com/wagtail/wagtail-localize/blob/bb04c7627701c7922be66389a1aaa2a721a09559/wagtail_localize/static_src/common/components/ImageChooser/index.tsx#L46
I'd be happy to provide a solution - maybe just render - "deleted image {id}" in the widget instead of the image thumbnail?