File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
packages/core/src/internal Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ const shareLatest = <T>(
10
10
teardown = noop ,
11
11
) : BehaviorObservable < T > => {
12
12
let subject : Subject < T > | undefined
13
- let subscription : Subscription | undefined
13
+ let subscription : Subscription | undefined | null
14
14
let refCount = 0
15
15
let currentValue : T = EMPTY_VALUE
16
16
@@ -20,6 +20,7 @@ const shareLatest = <T>(
20
20
if ( ! subject ) {
21
21
subject = new Subject < T > ( )
22
22
innerSub = subject . subscribe ( subscriber )
23
+ subscription = null
23
24
subscription = source$ . subscribe (
24
25
( value ) => {
25
26
subject ! . next ( ( currentValue = value ) )
@@ -40,7 +41,7 @@ const shareLatest = <T>(
40
41
innerSub = subject . subscribe ( subscriber )
41
42
if ( currentValue !== EMPTY_VALUE ) {
42
43
subscriber . next ( currentValue )
43
- if ( ! subscription ) {
44
+ if ( subscription === undefined ) {
44
45
subscriber . next ( COMPLETE as any )
45
46
}
46
47
}
@@ -59,8 +60,8 @@ const shareLatest = <T>(
59
60
subject = undefined
60
61
if ( subscription ) {
61
62
subscription . unsubscribe ( )
62
- subscription = undefined
63
63
}
64
+ subscription = undefined
64
65
}
65
66
}
66
67
} ) as BehaviorObservable < T >
You can’t perform that action at this time.
0 commit comments