mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-06 11:16:10 +08:00
fix(sync-messaging): Have "Looking for messages..." update properly
Summary: Makes these messages update even if the user doesn't force a re-render by switching perspectives. Test Plan: tested manually Reviewers: evan, juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3715
This commit is contained in:
parent
4a77f318e5
commit
9eca19ca56
3 changed files with 12 additions and 18 deletions
|
@ -42,13 +42,18 @@ class ThreadList extends React.Component
|
||||||
constructor: (@props) ->
|
constructor: (@props) ->
|
||||||
@state =
|
@state =
|
||||||
style: 'unknown'
|
style: 'unknown'
|
||||||
|
syncing: false
|
||||||
|
|
||||||
componentDidMount: =>
|
componentDidMount: =>
|
||||||
|
@unsub = NylasSyncStatusStore.listen( => @setState
|
||||||
|
syncing: FocusedPerspectiveStore.current().hasSyncingCategories()
|
||||||
|
)
|
||||||
window.addEventListener('resize', @_onResize, true)
|
window.addEventListener('resize', @_onResize, true)
|
||||||
ReactDOM.findDOMNode(@).addEventListener('contextmenu', @_onShowContextMenu)
|
ReactDOM.findDOMNode(@).addEventListener('contextmenu', @_onShowContextMenu)
|
||||||
@_onResize()
|
@_onResize()
|
||||||
|
|
||||||
componentWillUnmount: =>
|
componentWillUnmount: =>
|
||||||
|
@unsub()
|
||||||
window.removeEventListener('resize', @_onResize, true)
|
window.removeEventListener('resize', @_onResize, true)
|
||||||
ReactDOM.findDOMNode(@).removeEventListener('contextmenu', @_onShowContextMenu)
|
ReactDOM.findDOMNode(@).removeEventListener('contextmenu', @_onShowContextMenu)
|
||||||
|
|
||||||
|
@ -83,9 +88,9 @@ class ThreadList extends React.Component
|
||||||
'thread-list:select-starred': @_onSelectStarred
|
'thread-list:select-starred': @_onSelectStarred
|
||||||
'thread-list:select-unstarred': @_onSelectUnstarred
|
'thread-list:select-unstarred': @_onSelectUnstarred
|
||||||
|
|
||||||
_renderFooterContent: ->
|
_getFooter: ->
|
||||||
|
return null unless @state.syncing
|
||||||
return null if ThreadListStore.dataSource().count() <= 0
|
return null if ThreadListStore.dataSource().count() <= 0
|
||||||
return null unless FocusedPerspectiveStore.current().hasSyncingCategories()
|
|
||||||
return <SyncingListState />
|
return <SyncingListState />
|
||||||
|
|
||||||
render: ->
|
render: ->
|
||||||
|
@ -97,7 +102,7 @@ class ThreadList extends React.Component
|
||||||
itemHeight = 85
|
itemHeight = 85
|
||||||
|
|
||||||
<FluxContainer
|
<FluxContainer
|
||||||
renderFooterContent={@_renderFooterContent}
|
footer={@_getFooter()}
|
||||||
stores=[ThreadListStore]
|
stores=[ThreadListStore]
|
||||||
getStateFromStores={ -> dataSource: ThreadListStore.dataSource() }>
|
getStateFromStores={ -> dataSource: ThreadListStore.dataSource() }>
|
||||||
<FocusContainer collection="thread">
|
<FocusContainer collection="thread">
|
||||||
|
|
|
@ -151,17 +151,6 @@ class EmptyListState extends React.Component
|
||||||
@setState({rect})
|
@setState({rect})
|
||||||
|
|
||||||
_getStateFromStores: ->
|
_getStateFromStores: ->
|
||||||
currentPerspective = FocusedPerspectiveStore.current()
|
return syncing: FocusedPerspectiveStore.current().hasSyncingCategories()
|
||||||
accountIds = currentPerspective.accountIds
|
|
||||||
if accountIds.length == 1
|
|
||||||
accountId = accountIds[0]
|
|
||||||
categories = currentPerspective.categories
|
|
||||||
folderName = null
|
|
||||||
if categories.length == 1 and categories[0].object == 'folder'
|
|
||||||
folderName = categories[0].displayName
|
|
||||||
syncing = !NylasSyncStatusStore.isSyncCompleteForAccount(accountId, folderName)
|
|
||||||
else
|
|
||||||
syncing = NylasSyncStatusStore.busy()
|
|
||||||
return syncing: syncing
|
|
||||||
|
|
||||||
module.exports = EmptyListState
|
module.exports = EmptyListState
|
||||||
|
|
|
@ -22,10 +22,10 @@ class ListTabular extends React.Component
|
||||||
onSelect: React.PropTypes.func
|
onSelect: React.PropTypes.func
|
||||||
onClick: React.PropTypes.func
|
onClick: React.PropTypes.func
|
||||||
onDoubleClick: React.PropTypes.func
|
onDoubleClick: React.PropTypes.func
|
||||||
renderFooterContent: React.PropTypes.func
|
footer: React.PropTypes.node
|
||||||
|
|
||||||
@defaultProps =
|
@defaultProps =
|
||||||
renderFooterContent: => null
|
footer: => false
|
||||||
|
|
||||||
constructor: (@props) ->
|
constructor: (@props) ->
|
||||||
if not @props.itemHeight
|
if not @props.itemHeight
|
||||||
|
@ -190,7 +190,7 @@ class ListTabular extends React.Component
|
||||||
>
|
>
|
||||||
{@_rows()}
|
{@_rows()}
|
||||||
</div>
|
</div>
|
||||||
<div className="footer">{@props.renderFooterContent()}</div>
|
<div className="footer">{@props.footer}</div>
|
||||||
</ScrollRegion>
|
</ScrollRegion>
|
||||||
<Spinner visible={!@state.loaded and @state.empty} />
|
<Spinner visible={!@state.loaded and @state.empty} />
|
||||||
{emptyElement}
|
{emptyElement}
|
||||||
|
|
Loading…
Add table
Reference in a new issue