Changing storageID shouldn't cause rerender

This commit is contained in:
Fedor Indutny 2021-10-28 15:38:37 -07:00 committed by GitHub
parent 09250abb1e
commit 71ee0568c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 3 deletions

View file

@ -1056,7 +1056,7 @@ export async function startApp(): Promise<void> {
maxSize: Infinity, maxSize: Infinity,
}); });
convoCollection.on('change', conversation => { convoCollection.on('props-change', conversation => {
if (!conversation) { if (!conversation) {
return; return;
} }

View file

@ -101,6 +101,7 @@ import { SEALED_SENDER } from '../types/SealedSender';
import { getAvatarData } from '../util/getAvatarData'; import { getAvatarData } from '../util/getAvatarData';
import { createIdenticon } from '../util/createIdenticon'; import { createIdenticon } from '../util/createIdenticon';
import * as log from '../logging/log'; import * as log from '../logging/log';
import * as Errors from '../types/errors';
/* eslint-disable more/no-then */ /* eslint-disable more/no-then */
window.Whisper = window.Whisper || {}; window.Whisper = window.Whisper || {};
@ -126,6 +127,9 @@ const SEND_REPORTING_THRESHOLD_MS = 25;
const ATTRIBUTES_THAT_DONT_INVALIDATE_PROPS_CACHE = new Set([ const ATTRIBUTES_THAT_DONT_INVALIDATE_PROPS_CACHE = new Set([
'profileLastFetchedAt', 'profileLastFetchedAt',
'needsStorageServiceSync',
'storageID',
'storageUnknownFields',
]); ]);
type CachedIdenticon = { type CachedIdenticon = {
@ -315,6 +319,7 @@ export class ConversationModel extends window.Backbone
this.oldCachedProps = this.cachedProps; this.oldCachedProps = this.cachedProps;
} }
this.cachedProps = null; this.cachedProps = null;
this.trigger('props-change', this);
} }
); );
@ -3054,8 +3059,16 @@ export class ConversationModel extends window.Backbone
} }
getUuid(): UUID | undefined { getUuid(): UUID | undefined {
const value = this.get('uuid'); try {
return value && new UUID(value); const value = this.get('uuid');
return value && new UUID(value);
} catch (err) {
log.warn(
`getUuid(): failed to obtain conversation(${this.id}) uuid due to`,
Errors.toLogFormat(err)
);
return undefined;
}
} }
getCheckedUuid(reason: string): UUID { getCheckedUuid(reason: string): UUID {