From 1e9c9c779b6dc9e3c15ad54f94752deecc723fd8 Mon Sep 17 00:00:00 2001 From: Goga Koreli Date: Sat, 28 Sep 2019 14:12:52 +1000 Subject: [PATCH] fix: clear subscription on shareReplay completion 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 30788a08713..400ddc8de50 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(); }, });