Mailspring/internal_packages/inbox-activity-bar/lib/activity-bar-long-poll-item.cjsx
Ben Gotow 3ba6c7c59a fix(thread-list): Archive performance improvements, white rows fix
Summary:
Debounce changes out of the DatabaseStore to prevent lots of calls to persistModel from flooding the app

Tasks must always call super so they get IDs

The task queue shouldn't save every time it adds/removes a task - there could be hundreds

ActivityBar package is actually surprisingly slow, re-rendering needlessly

setState in MultiselectList sometimes renders immediately. Don't do this, because sometimes we're rendering twice back to back

Remove dead references

Never allow duplicate tags in the tags array

Don't archive threads that already have the archive tag (it doesn't do anything bad, but why bother creating tasks?)

Update DB specs

Test Plan: Run tests

Reviewers: evan

Reviewed By: evan

Differential Revision: https://review.inboxapp.com/D1506
2015-05-14 14:12:53 -07:00

37 lines
1.1 KiB
CoffeeScript

React = require 'react/addons'
moment = require 'moment'
Utils = require 'inbox-exports'
class ActivityBarLongPollItem extends React.Component
@displayName: 'ActivityBarLongPollItem'
constructor: (@props) ->
@state = expanded: false
shouldComponentUpdate: (nextProps, nextState) =>
return not Utils.isEqualReact(nextProps, @props) or not Utils.isEqualReact(nextState, @state)
render: =>
if @state.expanded
payload = JSON.stringify(@props.item)
else
payload = []
itemId = @props.item.id
itemVersion = @props.item.version || @props.item.attributes?.version
itemId += " (version #{itemVersion})" if itemVersion
timestamp = moment(@props.item.timestamp).format("h:mm:ss")
<div className={"item"} onClick={ => @setState expanded: not @state?.expanded}>
<div className="cursor">{@props.item.cursor}</div>
{" #{timestamp}: #{@props.item.event} #{@props.item.object} #{itemId}"}
<div className="payload" onClick={ (e) -> e.stopPropagation() }>
{payload}
</div>
</div>
module.exports = ActivityBarLongPollItem