Skip to content

Commit

Permalink
Changing storageID shouldn't cause rerender
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny-signal committed Oct 28, 2021
1 parent 09250ab commit 71ee056
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ts/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ export async function startApp(): Promise<void> {
maxSize: Infinity,
});

convoCollection.on('change', conversation => {
convoCollection.on('props-change', conversation => {
if (!conversation) {
return;
}
Expand Down
17 changes: 15 additions & 2 deletions ts/models/conversations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ import { SEALED_SENDER } from '../types/SealedSender';
import { getAvatarData } from '../util/getAvatarData';
import { createIdenticon } from '../util/createIdenticon';
import * as log from '../logging/log';
import * as Errors from '../types/errors';

/* eslint-disable more/no-then */
window.Whisper = window.Whisper || {};
Expand All @@ -126,6 +127,9 @@ const SEND_REPORTING_THRESHOLD_MS = 25;

const ATTRIBUTES_THAT_DONT_INVALIDATE_PROPS_CACHE = new Set([
'profileLastFetchedAt',
'needsStorageServiceSync',
'storageID',
'storageUnknownFields',
]);

type CachedIdenticon = {
Expand Down Expand Up @@ -315,6 +319,7 @@ export class ConversationModel extends window.Backbone
this.oldCachedProps = this.cachedProps;
}
this.cachedProps = null;
this.trigger('props-change', this);
}
);

Expand Down Expand Up @@ -3054,8 +3059,16 @@ export class ConversationModel extends window.Backbone
}

getUuid(): UUID | undefined {
const value = this.get('uuid');
return value && new UUID(value);
try {
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 {
Expand Down

0 comments on commit 71ee056

Please sign in to comment.