Subscriptions are not executed in NgZone
See original GitHub issueIf a subscription event comes, the store is updated, the observable emits, but no change detection is running in angular. (I need to interact with a component to get the view being updated)
// service
const gameChanges = gql`
subscription GameChanges {
gameChanged {
...GameFragment
}
}
${UserFragment}
${GameFragment}
`;
this.gameChanges$ = apollo.subscribe({
query: gameChanges
}).map((r: { gameChanged: Game }) => r.gameChanged)
// component
this._gameService.gameChanges$.subscribe(g => console.log(`game changed: ${g.id}`));
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Subscriptions are not executed in NgZone · Issue #320 - GitHub
If a subscription event comes, the store is updated, the observable emits, but no change detection is running in angular.
Read more >Subscribe not working even in NgZone.run() - angular
I have a service which gets the data from API. Data is getting returned from API but subscribe is not working in the...
Read more >NgZone - Angular
A zone is an execution context that persists across async tasks. ... serverUrl).subscribe(response => { // user does not need to trigger change...
Read more >Running event listeners outside of the NgZone - InDepth.Dev
NgZone notifies Angular when to perform the change detection process (e.g. a DOM event with bound listener is one of the triggerers).
Read more >Boosting performance of Angular applications with manual ...
We can perform an async operation without triggering change detection. NgZone has an API runOutsideAngular that runs code in NgZone's _outer zone, here...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Workaround No.2 - wrapping the watchQuery observable into
NgZone
:works in
apollo-angular@1.0.0