From 09ef4d85e044b330abb759cb328874334e4e8392 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Mon, 24 May 2021 11:51:47 -0700 Subject: [PATCH] onChange: Emit changed event even if changed set is empty --- ts/models/conversations.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ts/models/conversations.ts b/ts/models/conversations.ts index dc43114b6..ac4a7334e 100644 --- a/ts/models/conversations.ts +++ b/ts/models/conversations.ts @@ -293,8 +293,12 @@ export class ConversationModel extends window.Backbone // We clear our cached props whenever we change so that the next call to format() will // result in refresh via a getProps() call. See format() below. this.on('change', () => { - const isPropsCacheStillValid = Object.keys(this.changed).every(key => - ATTRIBUTES_THAT_DONT_INVALIDATE_PROPS_CACHE.has(key) + const changedKeys = Object.keys(this.changed || {}); + const isPropsCacheStillValid = Boolean( + changedKeys.length && + changedKeys.every(key => + ATTRIBUTES_THAT_DONT_INVALIDATE_PROPS_CACHE.has(key) + ) ); if (isPropsCacheStillValid) { return;