mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-22 23:23:54 +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, @)
|
@_unlisteners.push NamespaceStore.listen(@_onNamespacesChanged, @)
|
||||||
@_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: ->
|
_onNamespacesChanged: ->
|
||||||
namespace = NamespaceStore.current()
|
namespace = NamespaceStore.current()
|
||||||
@_worker = NylasAPI.workerForNamespace(namespace)
|
@_worker = NylasAPI.workerForNamespace(namespace)
|
||||||
|
|
|
@ -39,6 +39,10 @@ class ThreadListIcon extends React.Component
|
||||||
msgs = _.filter msgs, (m) -> m.isSaved() and not m.draft
|
msgs = _.filter msgs, (m) -> m.isSaved() and not m.draft
|
||||||
return msgs
|
return msgs
|
||||||
|
|
||||||
|
shouldComponentUpdate: (nextProps) =>
|
||||||
|
return false if nextProps.thread is @props.thread
|
||||||
|
true
|
||||||
|
|
||||||
render: =>
|
render: =>
|
||||||
<div className="thread-icon #{@_iconType()}" onClick={@_onToggleStar}></div>
|
<div className="thread-icon #{@_iconType()}" onClick={@_onToggleStar}></div>
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ class ThreadListParticipants extends React.Component
|
||||||
@propTypes:
|
@propTypes:
|
||||||
thread: React.PropTypes.object.isRequired
|
thread: React.PropTypes.object.isRequired
|
||||||
|
|
||||||
|
shouldComponentUpdate: (nextProps) =>
|
||||||
|
return false if nextProps.thread is @props.thread
|
||||||
|
true
|
||||||
|
|
||||||
render: =>
|
render: =>
|
||||||
items = @getParticipants()
|
items = @getParticipants()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue