-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/dynamic config load #1981
Feature/dynamic config load #1981
Conversation
With this approach is keeping config in apps state still necessary? @pkarw wdyt? |
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.
It’s a cool feature! Thanks a lot! Can You also add some docs on that?
@NataliaTepluhina could you please add these docs to the official resources?
@filrak yes, it’s bascially the only way to provide the config to CSR - we need config to properly execute client side code. Ofc we can do separate request just for config from Clients side but it makes no sense; it’s more optimal to keep it in state in this case. When user doesn’t require to have dynamic config reload then config is not provided to the clients side but just compiled into webpack bundle |
@pkarw Renamed the function and added basic Docs to the end of Config Docs. |
Awesome, Thanks! Will merge it once get in front of my computer :) |
Last thing, when the Promise is rejected (for some reason which could happen). There should be 2 options
These are rare occurrences but will eventually happen. @pkarw Should I add a config for dynamicConfigReload that can decide between these two? |
Yes Please, thats a good point. We should have the option in config for that 👍 |
Added the option and tested all options with latest changes to check that all works as expected. @pkarw Let me know if you come up with better naming for the option :-) It now allows to configure an option if it should continue with built time config or to be redirected to /error page. |
Perfect. Thanks! |
Related issues
None
Short description and why it's useful
This enables to load dynamic config on every page load.
Anyone can simply define loadConfig function within
src/server/index.js
that returns a Promise.Screenshots of visual changes before/after (if there are any)
None
Screenshot of passed e2e tests (if you are using our standard setup as a backend)
Using own API - tested locally (debug and visual)
Upgrade Notes and Changelog
Contribution and currently important rules acceptance