From 9f87505deae0aeae7dd53918e392487d6de7ab73 Mon Sep 17 00:00:00 2001 From: Nicholas Jamieson Date: Wed, 27 Nov 2019 04:12:46 +1000 Subject: [PATCH] fix: clear subscription on shareReplay completion (#5044) The subscription needs to be cleared to prevent the implementation holding a reference to the completed source. In Angular, not clearing the reference can lead to components not being garbage collected. Closes #5034 --- src/internal/operators/shareReplay.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/internal/operators/shareReplay.ts b/src/internal/operators/shareReplay.ts index 30788a0871..400ddc8de5 100644 --- a/src/internal/operators/shareReplay.ts +++ b/src/internal/operators/shareReplay.ts @@ -102,6 +102,7 @@ function shareReplayOperator({ }, complete() { isComplete = true; + subscription = undefined; subject.complete(); }, });