malte-wessel/react-textfit

crash in react-textfit when resizing window

chandde opened this issue · 0 comments

here's the call stack,

KEGo.t.innerWidth (innerSize.js:16)
value (Textfit.js:136)
n.handleWindowResize (Textfit.js:77)
s (throttle.js:26)
setTimeout (async)
(anonymous) (throttle.js:36)

in below function, el is null. according to the code, this el is an intermediate div wrapper that's not from consumer code but inside the library, is this something can be looked at?

I have a very good chance to reproduce this issue when the page is refreshed (just loaded) then resize the window, after that it seems to be fine.

// Calculate width without padding.
function innerWidth(el) {
    var style = window.getComputedStyle(el, null);
    return el.clientWidth - parseInt(style.getPropertyValue('padding-left'), 10) - parseInt(style.getPropertyValue('padding-right'), 10);
}