fix(category): Update isSyncComplete()

Summary:
When we've optimistically created a category and haven't seen
it come back through the remote yet, `.object` does not
exist. Just look up the sync state for the entire account in
this case.

Fixes T7556

Test Plan: tested manually

Reviewers: spang, evan, juan

Reviewed By: juan

Maniphest Tasks: T7556

Differential Revision: https://phab.nylas.com/D3711
This commit is contained in:
Halla Moore 2017-01-16 14:43:47 -08:00
parent 1e1117fe44
commit 2d53405b80

View file

@ -169,9 +169,10 @@ export default class Category extends Model {
}
isSyncComplete() {
// We sync by folders, not labels. So if the category is a label, just
// return based on the sync status for the entire account.
if (this.object === 'label') {
// We sync by folders, not labels. If the category is a label, or hasn't been
// assigned an object type yet, just return based on the sync status for the
// entire account.
if (this.object !== 'folder') {
return NylasSyncStatusStore.isSyncCompleteForAccount(this.accountId);
}
return NylasSyncStatusStore.isSyncCompleteForAccount(