-
Notifications
You must be signed in to change notification settings - Fork 48
Providers. Custom data loader, router #57
Conversation
@@ -5,7 +5,7 @@ const userConfigPath = path.join(process.cwd(), './config/universal-redux.config | |||
function getConfig() { | |||
try { | |||
const config = require(path.resolve(userConfigPath)); | |||
console.log('Loaded project level config', config); | |||
console.log(`Loaded project level config from ${userConfigPath}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was unrelated to the PR, redundant/noisy logging.
I really like the idea. I'll have a better look when I get home. |
@bdefore that just gave me an idea. We could introduce the concept of plugins. If we implement something like #56, plugins would define the equivalent of the
If you follow this logic, we could take the code in this PR and turn it into 2 plugin modules:
In export default {
plugins: ['async-props'] //or
plugins: ['async-connect']
} It's actually not that much work and I don't mind doing it if you think it's a good idea. It would also allow this project to remain pretty clean while allowing people to publish module to tailor its behavior. What do you think? |
@aam229 I like the approach you're describing and it would be great if you could take a stab at it. The only think I'd mention is to follow the naming convention of the library and name them i.e. |
@bdefore haha of course my bad, I keep messing up the order. I'll start working on it then |
Please be aware that webpack statically analyzes the require calls and will
choke on the dynamic requires (with expressions instead of static strings).
|
@sompylasar thank you for the thought, I ended up adding them to the |
… render. when devtools is active, will cause error that renders do not match
With #55 UR now supports custom root components.
Custom root components
createForServer
andcreateForClient
methods now receive an additional parameterproviders
of type array that contains strings matching libraries the user would like the root component to integrate. With this PR, universal-redux also provides built-in support for enabling either async-props or redux-async-connect.The API feels a little ... loose. But it has room to grow for potentially adding router5 support, or Relay/Falcor, and I'd rather not be too proscriptive at this point about what pieces users might want to include.
A downside is that UR bloats dependencies for each option it supports in the future. A longer-term solution could include exposing a provider API and expect users to give UR these dependencies themselves.
@aam229 Curious what you think about this addition.
Also. Is
providers
the right name for this functionality?integrations
?options
?