faceyspacey/redux-first-router

Allow to dynamically load reducer

Closed this issue · 1 comments

I'm currently stuck with an incompatiblity that prohibits me from using this library with redux-dynamic-modules, a library that allows to split redux related code into modules:
That library loads enhancers before loading reducers, since reducers can be added in dynamically later on via modules. Unfortunately this means that the [redux-first-router] you must provide the key of the location[...] error is thrown at me when trying to combine these two libraries. An easy fix would be to add an option that deactivates this error message (and falls back location to an empty object if it is not yet set). I could set up a PR, but would like to make sure first that this is the right way to go :)

Is it important that the location reducer specifically is dynamically loaded? Can that particular reducer be loaded initially?

If you have n routes, then you can get an O(n) saving of code size for any given route, but dynamically loading the location reducer doesn't seem to me to be adding much - since its going to be needed for all routes anyway.