Skip to content

Commit 4249cb6

Browse files
committed
fix(stream): when element is off the viewport CD should only be triggered if element is visible and value has changed
closes #40
1 parent 20c0a4e commit 4249cb6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libs/stream/src/lib/stream.directive.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,10 @@ export class StreamDirective<T> implements OnInit, OnDestroy {
261261
next: (val) => {
262262
const v = val[0] as any;
263263
const visible = val[1] ?? true;
264-
if (visible) {
264+
/**
265+
* only update the view if the value has changed and the view is visible
266+
*/
267+
if (visible && v !== this.context.$implicit) {
265268
this.context.$implicit = v;
266269
this.context.stream = v;
267270
this.context.loading = false;

0 commit comments

Comments
 (0)