wagtail-localize icon indicating copy to clipboard operation
wagtail-localize copied to clipboard

Deleted image breaks whole page editor

Open SteinRobert opened this issue 1 year ago • 9 comments

Description

  1. I create a synchronized translation of a page, including an ImageBlock- an image is chosen.
  2. I delete the image as an instance under (/cms/images).
  3. The synchronized page now breaks, it flashes the content for a moment and goes completely white.
Bildschirmfoto 2024-01-30 um 11 55 22

The JS is breaking at this point: image

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?

SteinRobert avatar Jan 30 '24 10:01 SteinRobert

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?

Nigel2392 avatar Jan 30 '24 18:01 Nigel2392

Here you go:

Bildschirmfoto 2024-01-30 um 21 22 35

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.

SteinRobert avatar Jan 30 '24 20:01 SteinRobert

Here you go:

Bildschirmfoto 2024-01-30 um 21 22 35 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?

Nigel2392 avatar Jan 30 '24 20:01 Nigel2392

Sorry overlooked. As mentioned:

I delete the image as an instance under (/cms/images).

The image model instance was deleted through the wagtail ui.

SteinRobert avatar Jan 30 '24 20:01 SteinRobert