Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐞[BUG]: Logger logs out of order when multiple actions are dispatched #561

Open
guilhermechiara opened this issue Sep 5, 2018 · 2 comments

Comments

@guilhermechiara
Copy link
Contributor

guilhermechiara commented Sep 5, 2018

Versions

* @angular/core: 6.0.0
* @ngxs/store: 3.2.0
* @ngxs/logger-pluggin: 3.2.0

Repro steps

Stackblitz: https://stackblitz.com/edit/angular-l4zxsn

  • Create two different actions and their respective Success actions.
  • Use a service to return data.
  • Dispatch the two actions at the same time.

Observed behavior

When you have multiple actions that are dispatched at the same time, the logger group the actions, creating some confusion to understand what is happening.

image

For me, does not make sense Load Toppings to be inside of Load Pizzas. Well, I don't exactly know how grouping works, but if you use some delay, then the actions are correctly set.

ngOnInit() {
    this.store.dispatch(new LoadPizzas());
    this.store.dispatch(new LoadToppings());
  }
@Action(LoadPizzas)
  load(context: StateContext<PizzasStateModel>) {
    return this.http.get('https://www.mocky.io/v2/5b8fb99d2e00002a00a89be4?mocky-delay=3000ms')
    .pipe(
      map(value => context.dispatch(new LoadPizzaSuccess(value)))
    );
  }

Desired behavior

I think that the logger should not group those Actions, since they are not exactly children of each other. It creates a little bit confusion when you look at your logs and try to understand what is happening. Actually, I don't know whether this is a normal behavior or not.

Thanks in advance! :)

@markwhitfeld
Copy link
Member

This is a duplicate of issue #213.

@internalsystemerror
Copy link
Contributor

Cancelling a previous uncompleted action results in this nesting also, I suspect the resolution for that would be the same as for this.

@splincode splincode changed the title Logger logs out of order when multiple actions are dispatched 🐞[BUG]: Logger logs out of order when multiple actions are dispatched Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants