Ionic-deploy + ngx-image-cropper: image not displaying after relaunching app

This is such a strange issue so just posting in case anywhere knows where to investigate next as I’m completely stumped.

I have a Cordova Ionic (v6) app that uses ngx-image-cropper npm plugin to crop images.

If I run the app without ionic-deploy, the ngx-image-cropper plugin works perfect. You select an image, the image shows up, you crop it & I upload the cropped image. If I close the app out of the background & open it back up, still works as normal.

If I run the app with ionic-deploy it goes as follows:

  1. App opens up, grabs newest version from code-deploy, applies it and the image cropper works as expected still.
  2. This is where it gets weird: If I close the app out of the background and open it back up, it’s still on the same code-deploy version so there’s nothing new to download/apply, however when the image-cropper gets the imageChangedEvent, the image doesn’t show up on the cropper.

I’m baffled at what is happening, I’ve checked in Safari Develop console log & there’s no error messages.

I put a bunch of console logs throughout and they all seem normal (passing the image around, file input change events, etc.

Does anyone have any idea what to look into next?

I noticed on the first launch when it works vs the 2nd launch when it doesn’t work the base64 being inserted into the image-cropper is different… Note the working one on the first launch uses a jpeg , the broken one uses a png … shouldn’t they be the same? It’s the same image I’m testing with

This is definitely a challenging one! Please share some relevant code, especially how you are using ngx-image-cropper.

Based on the info you shared, if the issue comes from a live update, it’s most likely not the live update plugin itself, but rather the code commits (live updates) being applied. Do you have any code changes that changes how image cropper is used? Since you mention JPG vs PNG.

Check closely to ensure that the code you are running locally is the same as the live update you’ve set in Appflow.

@netkow thank you for the reply. I finally figured out a fix after a long time trying…

The solution was to reference the “fileReader._realReader” instead of just the fileReader if the file is a Blob. I’m not sure why that fix works but I got the solution from this comment for anyone reading this in the future:

1 Like