Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleted image breaks whole page editor #769

Open
SteinRobert opened this issue Jan 30, 2024 · 8 comments
Open

Deleted image breaks whole page editor #769

SteinRobert opened this issue Jan 30, 2024 · 8 comments
Labels
help wanted Extra attention is needed

Comments

@SteinRobert
Copy link

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:

I'd be happy to provide a solution - maybe just render - "deleted image {id}" in the widget instead of the image thumbnail?

@Nigel2392
Copy link
Contributor

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?

@SteinRobert
Copy link
Author

SteinRobert commented Jan 30, 2024

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.

@Nigel2392
Copy link
Contributor

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?

@SteinRobert
Copy link
Author

Sorry overlooked. As mentioned:

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

The image model instance was deleted through the wagtail ui.

@danthedeckie
Copy link

I can confirm, same behaviour here.

@zerolab zerolab added the help wanted Extra attention is needed label May 15, 2024
@zerolab
Copy link
Collaborator

zerolab commented May 15, 2024

Sorry all, I somehow missed this one.
If anyone has the time, a PR will be most welcome

@Nigel2392
Copy link
Contributor

Possibly some sort of DB constraint should be enforced to prevent this somehow? Don't have time either but might be helpful.

@zerolab
Copy link
Collaborator

zerolab commented May 15, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants