diff --git a/packages/client-app/internal_packages/thread-list/lib/thread-list.cjsx b/packages/client-app/internal_packages/thread-list/lib/thread-list.cjsx index d5fa606ba..99ef49170 100644 --- a/packages/client-app/internal_packages/thread-list/lib/thread-list.cjsx +++ b/packages/client-app/internal_packages/thread-list/lib/thread-list.cjsx @@ -10,6 +10,7 @@ classnames = require 'classnames' SyncingListState} = require 'nylas-component-kit' {Actions, + Utils, Thread, Category, CanvasUtils, @@ -45,13 +46,17 @@ class ThreadList extends React.Component componentDidMount: => @_reportAppBootTime() - @unsub = NylasSyncStatusStore.listen( => @setState - syncing: FocusedPerspectiveStore.current().hasSyncingCategories() - ) + @unsub = NylasSyncStatusStore.listen(@_onSyncStatusChanged) window.addEventListener('resize', @_onResize, true) ReactDOM.findDOMNode(@).addEventListener('contextmenu', @_onShowContextMenu) @_onResize() + shouldComponentUpdate: (nextProps, nextState) => + return ( + (not Utils.isEqualReact(@props, nextProps)) or + (not Utils.isEqualReact(@state, nextState)) + ) + componentDidUpdate: => dataSource = ThreadListStore.dataSource() threads = dataSource.itemsCurrentlyInView() @@ -221,6 +226,10 @@ class ThreadList extends React.Component accountIds: [thread.accountId] } + _onSyncStatusChanged: => + syncing = FocusedPerspectiveStore.current().hasSyncingCategories() + @setState({syncing}) + _onShowContextMenu: (event) => data = @_targetItemsForMouseEvent(event) if not data