Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
249 views
in Technique[技术] by (71.8m points)

angular - In which order are executed effects in NGRX

Let's say I have one action A and two effects subscribing to it :

@Injectable
export class CustomEffects {
  constructor(
    private actions$: Actions,
  ) { }

  effect_1$ = createEffect(() => this.actions$.pipe(
    ofType(Actions.A),
    map(() => Actions.B)
  ));

  effect_2$ = createEffect(() => this.actions$.pipe(
    ofType(Actions.A),
    map(() => Actions.C)
  ));
}

Does there is a specific order in which the actions will be thrown ? Like B then C following subscription order ?

question from:https://stackoverflow.com/questions/65952648/in-which-order-are-executed-effects-in-ngrx

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It does this from top to bottom (top is registered first). You can double-check this by adding a log inside each effect.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...