From a74568168445c9e904d944cc40d7b3ff79f4e733 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Thu, 7 May 2015 15:37:42 -0700 Subject: [PATCH] fix(list-tabular): Invariant error caused by onDoneReceivingScrollEvents --- src/components/list-tabular.cjsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/list-tabular.cjsx b/src/components/list-tabular.cjsx index e05648a4e..171734ddb 100644 --- a/src/components/list-tabular.cjsx +++ b/src/components/list-tabular.cjsx @@ -78,6 +78,9 @@ class ListTabular extends React.Component componentDidMount: => @updateRangeState() + componentWillUnmount: => + clearTimeout(@_scrollTimer) if @_scrollTimer + componentDidUpdate: (prevProps, prevState) => # If our view has been swapped out for an entirely different one, # reset our scroll position to the top. @@ -92,10 +95,8 @@ class ListTabular extends React.Component # Create an event that fires when we stop receiving scroll events. # There is no "scrollend" event, but we really need one. - @_scrollTick ?= _.debounce => - @onDoneReceivingScrollEvents() - , 100 - @_scrollTick() + clearTimeout(@_scrollTimer) if @_scrollTimer + @_scrollTimer = setTimeout(@onDoneReceivingScrollEvents, 100) # If we just started scrolling, scrollInProgress changes our CSS styles # and disables pointer events to our contents for rendering speed