It's really getting on my nerves.
I came across a very basic Ionic v4 Project with a login flow that I checked out.
The demo worked perfectly fine, but since this project is already 5 months old, I decided to create a new Ionic project with the latest Ionic CLI and transfer the source code into it... using the most recent stable Ionic dependencies.
However, the rxJS-BehaviorSubject (authState$) is behaving strangely, as shown in the screenshot.
I added some console.logs to the isAuthenticated() method:
console.log('isAuthenticated: ', this.authState$.getValue());
console.log('isAuthenticated: ', this.authState$);
The Console:
https://i.sstatic.net/HdVtl.png
What happened:
The getValue() method returns the initial value, while the printed object contains the correct value (true). This seems odd to me as both are called right after each other.
Reverting back to the original versions in the package.json makes it work again:
https://i.sstatic.net/lyMGM.png
The update of the Ionic project updated Angular from v6.1 to v7.2 (including its dependencies) and TypeScript from 2.9 to 3.1.
RXJS has been updated from 6.2.2 to 6.3.3.
I would greatly appreciate it if you could help me understand what's happening.
Update:
I believe I have identified one single dependency causing this issue.
Last working version: "@ionic/angular": "4.0.0-beta.17" Not working: any version higher than @ionic/[email protected].
When creating a new Ionic project, it comes with version 4.1.0. This means it cannot function properly with a new project.
Thank you so much in advance,
Sascha