react-simple-range icon indicating copy to clipboard operation
react-simple-range copied to clipboard

Cannot read properties of null (reading 'getBoundingClientRect')

Open codemonkeynorth opened this issue 2 years ago • 0 comments

Cannot read properties of null (reading 'getBoundingClientRect')

I think this happens if the the element is not ready in getSliderInfo()

quick fix:

var getSliderInfo = function getSliderInfo() {
var sl = sliderRef.current;
// --------------------------------
if(!sl) return null // fix issue if sliderRef isn't yet registered with the element
//----------------------------------
...

then we need to ignore the info if it's null from above

var updateSliderValue = function updateSliderValue(event, eventType) {
...
...
// --------------------------------
var info = getSliderInfo();
if(!info) return
// --------------------------------
...

codemonkeynorth avatar Sep 20 '23 14:09 codemonkeynorth