Pārlūkot izejas kodu

Avoids firing unneeded subscription change events

main
Eric Amodio pirms 2 gadiem
vecāks
revīzija
6f4791aeca
1 mainītis faili ar 9 papildinājumiem un 2 dzēšanām
  1. +9
    -2
      src/plus/subscription/subscriptionService.ts

+ 9
- 2
src/plus/subscription/subscriptionService.ts Parādīt failu

@ -759,12 +759,19 @@ export class SubscriptionService implements Disposable {
subscription.state = computeSubscriptionState(subscription);
assertSubscriptionState(subscription);
void this.storeSubscription(subscription);
const previous = this._subscription; // Can be undefined here, since we call this in the constructor
this._subscription = subscription;
// If the previous and new subscriptions are exactly the same, kick out
if (previous != null && JSON.stringify(previous) === JSON.stringify(subscription)) {
return;
}
void this.storeSubscription(subscription);
this._subscription = subscription;
this._etag = Date.now();
this.updateContext();
if (!silent && previous != null) {

Notiek ielāde…
Atcelt
Saglabāt