Skip to content

Conversation

fw-bot
Copy link
Contributor

@fw-bot fw-bot commented Mar 29, 2025

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

**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 to track the state of the cropper as full
mounting (including image loading) might take time.

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

opw-4607020

X-original-commit: b11f332
@robodoo
Copy link
Contributor

robodoo commented Mar 29, 2025

Pull request status dashboard

@fw-bot
Copy link
Contributor Author

fw-bot commented Mar 29, 2025

This PR targets saas-18.2 and is part of the forward-port chain. Further PRs will be created up to master.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@robodoo robodoo added the forwardport This PR was created by @fw-bot label Mar 29, 2025
@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Mar 29, 2025
@fw-bot
Copy link
Contributor Author

fw-bot commented Mar 29, 2025

@walidsahli @dmo-odoo the next pull request (#204076) is in conflict. You can merge the chain up to here by saying

@robodoo r+

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@walidsahli
Copy link
Contributor

@robodoo r+

robodoo pushed a commit that referenced this pull request Mar 29, 2025
**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 to track the state of the cropper as full
mounting (including image loading) might take time.

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

opw-4607020

closes #204075

X-original-commit: b11f332
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Walid Sahli (wasa) <wasa@odoo.com>
@robodoo robodoo closed this Mar 29, 2025
@fw-bot fw-bot deleted the saas-18.2-18.0-opw-4607020-fix_opening_closing_cropper_while_loading_image-wasa-425003-fw branch April 6, 2025 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

forwardport This PR was created by @fw-bot OE the report is linked to a support ticket (opw-...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants