Comments (5)
@sunger thanks for informing. for now you can ignore this warning. I will see how I can avoid such circular dependency.
I may have to reference AuthState's
selector
as text. but it is not working at the moment.
@amcdnl is there a solution/workaround for this case?
this.store.select(AuthState.authMode).subscribe(authMode => {
console.log(`Auth Mode Changed: ${this.authMode} => ${authMode}`);
this.authMode = authMode;
});
may be like this:
this.store.select('auth.authMode').subscribe(authMode => {
console.log(`Auth Mode Changed: ${this.authMode} => ${authMode}`);
this.authMode = authMode;
});
from ngx-starter-kit.
You can try:
@Select(AuthState) authMode$: Observable<AuthMode>;
from ngx-starter-kit.
@eranshmil as long as you use/refer AuthState
in AuthService
you will get Circular dependency WARNING.
if you don't want to see warning, then you can try this.
@Select('auth.authMode') authMode$: Observable<AuthMode>;
and
this.authMode$.subscribe(authMode => {
console.log(`Auth Mode Changed: ${this.authMode} => ${authMode}`);
this.authMode = authMode;
});
with this approach, I see ngxs store fires change event twice. which I don't like :(
Console log:
Auth Mode Changed: undefined => undefined
Auth Mode Changed: undefined => ImplicitFLow
With static reference to AuthState ie. this.store.select(AuthState.authMode).subscribe(....)
it only fire one time as I expected.
Auth Mode Changed: undefined => ImplicitFLow
from ngx-starter-kit.
I'd guess that's because the auth service is being initialized before auth state.
I recommend you to move some of the logic from auth service into the state, for example:
if (this.authMode === AuthMode.PasswordFlow) {
// For Password Flow
return this.ropcService.logOut();
} else {
// For ImplicitFlow
this.oauthService.logOut();
}
I don't see any reason for that to be in the service and not in an action.
from ngx-starter-kit.
fixed.
from ngx-starter-kit.
Related Issues (20)
- An in-range update of fortawesome is breaking the build 🚨
- An in-range update of @types/jest is breaking the build 🚨 HOT 2
- An in-range update of @angular-devkit/build-angular is breaking the build 🚨 HOT 1
- Action Required: Fix Renovate Configuration
- what is "var" ?
- Error with image-comparison HOT 2
- Need more documentation HOT 2
- Ivy fails with NGXS
- @ngx-starter-kit/ngx-utils removed from npm HOT 4
- Please re-publish also 0.0.3 version. HOT 4
- support for nestjs compiler plugins (e.g. for swagger)
- iPhone not ringing with incoming calls HOT 1
- Keycloak Default Config file not accessible
- An in-range update of filepond-plugin-image-preview is breaking the build 🚨 HOT 2
- Dependency Dashboard
- [Question] Testing & (Mock) Classes HOT 4
- An in-range update of @nrwl/workspace is breaking the build 🚨 HOT 1
- Error: original.line and original.column are not numbers
- An in-range update of @semantic-release/github is breaking the build 🚨 HOT 1
- How long does it take you to save a recompile boot
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-starter-kit.