I am working on a sample Angular 2 application , and using ngrx/store , ngrx/effects for state management.
Below image depicts one of the screens of my application.
In order to display books list , categories and authors from the server, below dispatch calls are made to the store.
this.store.dispatch(loadCatgories());
this.store.dispatch(loadAuthors());
this.store.dispatch(loadBooks());
And below the are the related effects
@Effect() authors$ = this.actions$
.ofType(AuthorActionTypes.LOAD_AUTHORS)
.switchMap(() => this.authorService.loadAuthors())
.map(authors => loadAuthorsSuccess(authors));
@Effect() categories$ = this.actions$
.ofType(CategoryActionTypes.LOAD_CATEGORIES)
.switchMap(() => this.service.loadCategories())
.map(categories => loadCategoriesSuccess(categories));
@Effect() books$ = this.actions$
.ofType(BookActionTypes.LOAD_BOOKS)
.switchMap(() => this.bookService.loadBooks())
.map(books => loadBooksSuccess(books));
My questions are
Is the above approach correct or is there any better way , for some reason some times books list is displayed for second and then they disappear.
If my understanding is correct , the above three dispatches are happening parallel, what if I need them to happen one after another.
