onChange: Emit changed event even if changed set is empty

This commit is contained in:
Scott Nonnenberg 2021-05-24 11:51:47 -07:00 committed by GitHub
parent 79a90802c0
commit 09ef4d85e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;