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

"Maximum update depth exceeded" when clicking the image #218

Closed
djorak opened this issue Nov 14, 2018 · 12 comments
Closed

"Maximum update depth exceeded" when clicking the image #218

djorak opened this issue Nov 14, 2018 · 12 comments

Comments

@djorak
Copy link

djorak commented Nov 14, 2018

I have been getting this error and it looks like it was introduced recently. At first I assumed it was an issue in my local setup, but I can reproduce it in the demo.

It seems to come from the fact that the onChange gets called in an infinite loop.

  • Version: 6.0.7
  • Steps to reproduce:
    1. open demo (Tried in Firefox and Chrome)
    2. upload an image
    3. click anywhere in the image
    4. notice React Error
  • Error:

Invariant Violation
Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.

image

Note: rolling back to v6.0.5 fixes it.

@djorak djorak changed the title "Maximum update depth exceeded." when clicking the image "Maximum update depth exceeded" when clicking the image Nov 14, 2018
@sekoyo
Copy link
Owner

sekoyo commented Nov 14, 2018

Hi this should be fixed in 6.0.8 please give it a go

@djorak
Copy link
Author

djorak commented Nov 14, 2018

Thank you, 6.0.8 fixed it. 🙂

@sekoyo
Copy link
Owner

sekoyo commented Nov 14, 2018

Great thanks for checking

@sekoyo sekoyo closed this as completed Nov 14, 2018
@noashka
Copy link

noashka commented Jan 22, 2019

Hello. I have the same problem. When I upload an image in the first time and trying change cropp size I have this error. I took example code from the demo folder
react 16.6
react-image-crop 6.0.11

But when I downgrade module version to 6.0.8 it works fine

@sekoyo
Copy link
Owner

sekoyo commented Jan 22, 2019

@noashka thanks can you please let me know the dimensions of the image you tried and also the crop settings? And does it happen every time when you try to resize the crop?

I will take a look at it this evening

@noashka
Copy link

noashka commented Jan 22, 2019

I used a simple jpeg image, 435x512px.
I used example code from the demo folder. I changed only module import.
If I use initial crop area, I get an error.
If I set new crop area, all works fine

@sekoyo sekoyo reopened this Jan 22, 2019
@sekoyo
Copy link
Owner

sekoyo commented Jan 22, 2019

Thanks @noashka, if you get a moment I'm curious if you get the same error on https://codesandbox.io/s/72py4jlll6

Edit: I've spotted one issue but not sure if it's the cause, anyway I'll try and repro later and fix the issue I spotted

@noashka
Copy link

noashka commented Jan 22, 2019

@dominictobias yes, I get the same error

@sekoyo
Copy link
Owner

sekoyo commented Jan 22, 2019

Thanks, interesting I can't actually replicate but I've seen it before but not sure what I did. I choose an image and then play around with moving and resizing and didn't manage to break it yet.

@sekoyo
Copy link
Owner

sekoyo commented Jan 23, 2019

@noashka Please try 6.0.12 this issue should be fixed now. It was proving too problematic to try and fix/complete invalid aspect crops every component update/render, so I just fix/complete them if they are incorrect on image load

@noashka
Copy link

noashka commented Jan 24, 2019

@dominictobias You've fixed it! Thank you for help!

@sekoyo
Copy link
Owner

sekoyo commented Jan 24, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants