@@ -168,8 +168,6 @@ function sizeMe(config = defaultConfig) {
168168
169169 const refreshDelayStrategy = refreshMode === 'throttle' ? throttle : debounce
170170
171- const detector = resizeDetector ( resizeDetectorStrategy )
172-
173171 return function WrapComponent ( WrappedComponent ) {
174172 const SizeMeRenderWrapper = renderWrapper ( WrappedComponent )
175173
@@ -187,6 +185,7 @@ function sizeMe(config = defaultConfig) {
187185 }
188186
189187 componentDidMount ( ) {
188+ this . detector = resizeDetector ( resizeDetectorStrategy )
190189 this . determineStrategy ( this . props )
191190 this . handleDOMNode ( )
192191 }
@@ -206,7 +205,7 @@ function sizeMe(config = defaultConfig) {
206205 this . checkIfSizeChanged = ( ) => undefined
207206
208207 if ( this . domEl ) {
209- detector . uninstall ( this . domEl )
208+ this . detector . uninstall ( this . domEl )
210209 this . domEl = null
211210 }
212211 }
@@ -245,18 +244,18 @@ function sizeMe(config = defaultConfig) {
245244 if ( ! found ) {
246245 // This is for special cases where the element may be null.
247246 if ( this . domEl ) {
248- detector . uninstall ( this . domEl )
247+ this . detector . uninstall ( this . domEl )
249248 this . domEl = null
250249 }
251250 return
252251 }
253252
254253 if ( this . domEl ) {
255- detector . uninstall ( this . domEl )
254+ this . detector . uninstall ( this . domEl )
256255 }
257256
258257 this . domEl = found
259- detector . listenTo ( this . domEl , this . checkIfSizeChanged )
258+ this . detector . listenTo ( this . domEl , this . checkIfSizeChanged )
260259 }
261260
262261 refCallback = element => {
0 commit comments