Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@guilhermechiara

Description

@guilhermechiara

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! :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions