odoo/odoo#204075

Created by fw-bot
Merged at daea8413e6334f3539603d54dddce8f277461c9f

Statuses:

label
odoo-dev:saas-18.2-18.0-opw-4607020-fix_opening_closing_cropper_while_loading_image-wasa-425003-fw
head
38baaddd6628236a4ea95a95ab444239efae29e2
merged
7 months ago by Walid Sahli (wasa)
odoo/odoo
18.0 #200729
saas-18.1 #203102
saas-18.2 #204075
saas-18.3
saas-18.4
19.0
master #204076

[FW][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

Forward-Port-Of: #203102
Forward-Port-Of: #200729