`croppie.destroy()` causes errors
See original GitHub issueError 1
// This error happens because `opts.update()` is called after `destroy()`
Uncaught (in promise) TypeError: Cannot read property 'preview' of undefined
at Croppie._get (webpack-internal:///223:1318:37)
at Croppie._result (webpack-internal:///223:1353:25)
at Croppie.result (webpack-internal:///223:1569:28)
Error 2
// This error happens because `_updateOverlay()` is triggered by `_debouncedOverlay()`
// after a `destroy()`, and `self.elements` is null
Uncaught TypeError: Cannot read property 'boundary' of undefined
at Croppie._updateOverlay (croppie.js?f101:939)
at later (croppie.js?f101:102)
function _updateOverlay() {
var self = this,
boundRect = self.elements.boundary.getBoundingClientRect(),
imgData = self.elements.preview.getBoundingClientRect();
...
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (2 by maintainers)
Top Results From Across the Web
destroy or reset image croppie - javascript - Stack Overflow
The problem I've had with destroy is that once you destroy the instance, then you go to reinitialize croppie after that (say after...
Read more >Unexpected token < in JSON at position 0 - Dave Ceddia
The root cause is that the server returned HTML or some other non-JSON string. Why would it do that? “Unexpected token o in...
Read more >STATE OF MINNESOTA - MN.gov
Emergencies Caused by a Storm, Act of God, Power Loss, or Similar Event. ... An “error” in Frontier's software caused the wrong closing...
Read more >December 20, 2018 FERC Project No. 2336-094 Lloyd Shoals ...
of a fish kill in a cove of Lake Jackson near Elizabeth Circle in Butts ... their cause, severity, and measures taken to...
Read more >Roy Lake State Park - South Dakota - Game, Fish, and Parks
Other species include black bullhead, black crappie, bluegill, ... k) The Department makes no representations as to the validity of the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I was encountering this because I had moved one of the Croppie components (the zoom slider) from the Croppie container into our container.
Calling
destroy()
with some Croppie elements intentionally placed elsewhere in the DOM threw an error. It looked like Croppie was trying to search for known children and couldn’t find them in the original parent container.When I put the slider back into the original Croppie container, then proceed to can call
destroy()
, the instance is destroyed without error.Good catch. I guess the simplest fix would be adding a
at the top of the _updateOverlay.