From 1c901e090afca3092b3018c5982cdca60a9474ce Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Fri, 26 Jun 2015 16:08:41 -0700 Subject: [PATCH] fix(invariant): Warnings when trying to settle scroll state after unmount --- internal_packages/message-list/lib/message-list.cjsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal_packages/message-list/lib/message-list.cjsx b/internal_packages/message-list/lib/message-list.cjsx index 30de5bd1d..224be24da 100755 --- a/internal_packages/message-list/lib/message-list.cjsx +++ b/internal_packages/message-list/lib/message-list.cjsx @@ -61,6 +61,8 @@ class MessageList extends React.Component @MINIFY_THRESHOLD = 3 componentDidMount: => + @_mounted = true + window.addEventListener("resize", @_onResize) @_unsubscribers = [] @_unsubscribers.push MessageStore.listen @_onChange @@ -80,6 +82,7 @@ class MessageList extends React.Component @_prepareContentForDisplay() componentWillUnmount: => + @_mounted = false unsubscribe() for unsubscribe in @_unsubscribers @command_unsubscriber.dispose() @@ -210,6 +213,7 @@ class MessageList extends React.Component lastHeight = -1 stableCount = 0 scrollIfSettled = => + return unless @_mounted messageWrapHeight = messageWrap.getBoundingClientRect().height if messageWrapHeight isnt lastHeight lastHeight = messageWrapHeight