Skip to content

Commit 6f4791a

Browse files
committed
Avoids firing unneeded subscription change events
1 parent 725d981 commit 6f4791a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/plus/subscription/subscriptionService.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,12 +759,19 @@ export class SubscriptionService implements Disposable {
759759

760760
subscription.state = computeSubscriptionState(subscription);
761761
assertSubscriptionState(subscription);
762-
void this.storeSubscription(subscription);
763762

764763
const previous = this._subscription; // Can be undefined here, since we call this in the constructor
765-
this._subscription = subscription;
766764

765+
// If the previous and new subscriptions are exactly the same, kick out
766+
if (previous != null && JSON.stringify(previous) === JSON.stringify(subscription)) {
767+
return;
768+
}
769+
770+
void this.storeSubscription(subscription);
771+
772+
this._subscription = subscription;
767773
this._etag = Date.now();
774+
768775
this.updateContext();
769776

770777
if (!silent && previous != null) {

0 commit comments

Comments
 (0)