question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

% unit is somehow causing "Maximum update depth exceeded"

See original GitHub issue

Hi,

we are using react-image-crop:8.6.2 in our project and if we set unit in crop object to “%” it ends up with “Maximum update depth exceeded”.

<ReactCrop
  src={image}
  crop={crop}
  ruleOfThirds
  onImageLoaded={onImageLoaded}
  onComplete={onCropComplete}
  onChange={onCropChange} // just setting state
  keepSelection
/>
const [currentCrop, setCurrentCrop] = useState({
    unit: '%', // `'px' here just works fine`
    width: 100,
    height: 50,
    x: 25,
    y: 25,
    ...imageCrop,
  });

Screenshot 2020-06-05 at 14 51 28

The last working version was 8.5.0.

Thank you for your help.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
literatcommented, Jun 5, 2020

Thank you. 8.6.3 is working just fine. 👍

0reactions
DominicTobiascommented, Jun 5, 2020

Ok cool, this should be fixed in 8.6.3 anyway. If you do want to limit the crop width though I recommend just doing it on a container element of the crop (but it should work now). Closing but please feel free to add any issues with it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReactJS: Maximum update depth exceeded error
Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate.
Read more >
Fix the "Maximum Update Depth Exceeded" Error in React
One of which is when you accidentally cause an infinite render loop, often resulting in the cryptic “maximum update depth exceeded” error.
Read more >
"Maximum update depth exceeded" with version 7.1.0 · Issue ...
"Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate.
Read more >
React - maximum update depth exceeded - CodeProject
Yes! I solved this problem! It was because of the useEffect(), but it wasn't because it was being used twice.
Read more >
How to Fix Maximum Update Depth Exceeded in React and ...
In this video, I show you several ways the dreaded " Max Update Depth Exceeded " error commonly occurs in React and React...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found