I am actually quite comfortable with rxjs & ngrx etc, but I am experiencing a weird issue that some help/tips would be very valuable for:
I am using a subject as a service like this:
game$: Observable<Game | null> = this.gameSubject$.asObservable().pipe(tap(game => console.log("Observable emission", game)));```
And then I am triggering it like this here:
```private setGameStreamIfNull(game: Game): void {
const currentValue = this.gameSubject$.getValue();
if (currentValue === null) {
this.getGameDocData(game).subscribe(gameData => {
console.log("Stream Emission, nexting", gameData);
this.gameSubject$.next(gameData);
});
}
}```
The problem:
this gets logged:
`console.log("Stream Emission, nexting", gameData);`
but after, this does not get logged:
`console.log("Observable emission", game)`
Even though I am clearly subscribing to the asObservable here:
```this.gameSubscription = this.game$.subscribe((game => {
console.log('Emission in multiplayer page:', game);
if (game !== null) {
this.assignAvatars(game);
}
if (!this.hasNavigated && game !== null && game.status === GameStatus.running) {
const commands: (string | number)[] = [game.courseName, game.topicName, 'guess', GameMode.quiz, game.guessAction, PlayerMode.multiplayer];
if (game.topNLocations !== null) {
commands.push(game.topNLocations);
}
this.hasNavigated = true;
this.router.navigate(commands);
}
}));```
AND:
the game$ is not reassigned anywhere. It stays the same observable throughout...