Skip to content

Commit 9210187

Browse files
committed
always get the leading and trailing values, to ensure that we stay up-to-date.
See #79 (comment) for more details
1 parent 4b91627 commit 9210187

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

libs/core/src/lib/renderer/react-template.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,11 @@ export class ReactTemplate<TContext extends object | void> extends React.Compone
8888

8989
// Throttling the detect changes to an empirically selected value so we don't overload too much work.
9090
// TODO: This needs some better solution to listen to changes to the binding sources of the template.
91-
this._ngZoneSubscription = ngZone.onStable.pipe(throttleTime(TEMPLATE_DETECT_CHANGES_THROTTLE_MS)).subscribe(() => {
92-
this._embeddedViewRef.detectChanges();
93-
});
91+
this._ngZoneSubscription = ngZone.onStable
92+
.pipe(throttleTime(TEMPLATE_DETECT_CHANGES_THROTTLE_MS, undefined, { leading: true, trailing: true }))
93+
.subscribe(() => {
94+
this._embeddedViewRef.detectChanges();
95+
});
9496
}
9597

9698
componentWillUnmount() {

0 commit comments

Comments
 (0)