mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-21 06:34:34 +08:00
fix(thread-list): Add more shouldComponentUpdate to prevent threadlist re-rendering as you move keyboard cursor
This commit is contained in:
parent
b7e314ac62
commit
869331d799
3 changed files with 14 additions and 0 deletions
|
@ -82,6 +82,12 @@ class EmptyState extends React.Component
|
|||
@_unlisteners.push NamespaceStore.listen(@_onNamespacesChanged, @)
|
||||
@_onNamespacesChanged()
|
||||
|
||||
shouldComponentUpdate: (nextProps, nextState) ->
|
||||
# Avoid deep comparison of dataView, which is a very complex object
|
||||
return true if nextProps.visible isnt @props.visible
|
||||
return true if nextProps.dataView isnt @props.dataView
|
||||
return not _.isEqual(nextState, @state)
|
||||
|
||||
_onNamespacesChanged: ->
|
||||
namespace = NamespaceStore.current()
|
||||
@_worker = NylasAPI.workerForNamespace(namespace)
|
||||
|
|
|
@ -39,6 +39,10 @@ class ThreadListIcon extends React.Component
|
|||
msgs = _.filter msgs, (m) -> m.isSaved() and not m.draft
|
||||
return msgs
|
||||
|
||||
shouldComponentUpdate: (nextProps) =>
|
||||
return false if nextProps.thread is @props.thread
|
||||
true
|
||||
|
||||
render: =>
|
||||
<div className="thread-icon #{@_iconType()}" onClick={@_onToggleStar}></div>
|
||||
|
||||
|
|
|
@ -8,6 +8,10 @@ class ThreadListParticipants extends React.Component
|
|||
@propTypes:
|
||||
thread: React.PropTypes.object.isRequired
|
||||
|
||||
shouldComponentUpdate: (nextProps) =>
|
||||
return false if nextProps.thread is @props.thread
|
||||
true
|
||||
|
||||
render: =>
|
||||
items = @getParticipants()
|
||||
|
||||
|
|
Loading…
Reference in a new issue