odoo/odoo#200729

Created by Walid Sahli (wasa)
Merged at df64afb4e9504413f966a153772c568b625a5e13

Statuses:

label
odoo-dev:18.0-opw-4607020-fix_opening_closing_cropper_while_loading_image-wasa
head
b7a63f7d60494c65889ba6ce3fa18847a0abbb62
merged
7 months ago by Editor, David Monjoie (dmo)
odoo/odoo
18.0 #200729
saas-18.1 #203102
saas-18.2 #204075
saas-18.3
saas-18.4
19.0
master #204076

[FIX] html_editor: fix cropper issue with large images

Problem:
Loading large images into the cropper takes time. Closing the cropper early causes this.imageRef.el to be null or this.initialSrc to be undefined, leading to a traceback.

What happens:
1. Add a large image.
2. Click "Crop".
- This triggers show.
- While loadImage is still unresolved due to image size.
3. Click "Discard" to close the cropper before image loads.
- Issue: this.imageRef.el is null and this.initialSrc is undefined as the component is destroyed but loadImage has not resolved yet, when it is resolved a traceback will be appear.

Solution:
Add a lifecycle flag as full mounting of the cropper might take time.

Steps to Reproduce:
1. Add a large image.
2. Open cropper.
3. Close cropper before image loads.
- Issue: Traceback.

opw-4607020


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr