I am currently building an application using NgRx and the Router Store.
There is a dropdown in one component, that changes params in the url and navigates on the same component.
Since navigating on the same component doesn’t call NgOnInit the corresponding effect (that calls the API) is not called.
In my opinion, the effect should always be called if component has changed the params.
loadTransactions$ = createEffect(() => this.actions$.pipe( ofType( NavigationActions.ActionType.NavigateToTransactionsSuccess, TransactionsPageActions.ActionType.LoadPage ), [...] ));
One idea I had, was to create a custom action that only listens to navigations on the component with the dropdown, but i have no idea how to do this.
My current solution is following:
this.store.select(RouterSelectors.selectUrl).subscribe(() => this.store.dispatch(TransactionsPageActions.loadPage()) );
But this feels like it could cause some bugs in the future.
Is there any way to achieve this in a clean way?