tschuege
tschuege
Jul 25, 2017 · 1 min read

Thanks for that very helpful post.

I’m struggling applying that pattern to a bigger example.

Let’s say I have /talks and /talks/:id

When navigating to /talks I want to load all the talks and show them in a navigation. I would do that as you suggest in an effect using StoreRouterConnectingModule. Then I select the first talk, or the one last selected (e.g. stored in local storage) by programmatically navigating to /talks/:id. If the :id does not exist I want to select the first talk.

So when navigating to /talks/:id I need to know all the available tasks. So I ended up having a reference to the list of talks in the effects class by subscribing to the store in the effect handling the navigation to /talks and storing the result in a field.

But I don’t like that pattern because this way I end up having a reference of the data in the effect class. And if I scale it up to a larger project I might end up with various instances of basically all the data in the stores in various effects.

I’m not sure if I explained the problem well… do you have any suggestion on this?

    tschuege

    Written by

    tschuege

    web dev focusing on Angular