From 35e600fb031ba2814d65b586ca0664af85b179ba 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 28ed4f377d..c9620fe4f1 100644 --- a/src/internal/operators/shareReplay.ts +++ b/src/internal/operators/shareReplay.ts @@ -168,6 +168,7 @@ function shareReplayOperator({ }, complete() { isComplete = true; + subscription = undefined; subject.complete(); }, });