-
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
Refactor rootStore.state.config to dedicated module #2649
Comments
Imho it shouldn't be a module. More like a core lib |
Yes, core/lib |
What would You say for sth like: import { currentConfig } from '@vue-storefront/core/lib/config'
if (currentConfig().images.useExactUrlsNoProxy) { instead of: import rootStore from '@vue-storefront/core/store'
if (rootStore.state.config.images.useExactUrlsNoProxy) { ? |
why |
This is a function because we'll be taking the config from |
But we can easily modify plain JS objects too. What is a purpose of making this huge JSON reactive and part of VS state instead of having it in a separate module as an Object? Imho it's a huge overcomplication |
If the purpose of this issue is just to make alias for current behavior it doesn't make sense at all. Having config in a Vuex is a terrible idea that is really bad for either runtime and loading performance. It's not even application state. |
https://github.com/DivanteLtd/vue-storefront/pull/1800/files We're using the state to dynamically reload the config if this mode is enabled. Not sure if it could anyway lower the performance - we do have much larger objects in state (say: product's list) :) |
This doesn't answer my question why we are not using plain object for config instead of using Vuex state. Despite all the technical reasons why it shouldn't be part of apps state - the config itself with so many bindings in Vuex can make VS lag on low-end devices. |
Filip, the |
So we can have a separate lib+it's own config object to keep it after: loading from the bundle (in case |
Anyway maybe it w'd be faster to discuss this f2f - we could just have 5min discussion on this on Monday's core planning :) |
What is the motivation for adding / enhancing this feature?
The
rootStore.state.config.entities.attribute.includeFields
kind of paths are all around the code. We should create a dedicated moduleConfigManager
(like RouteManager) to keep the config.Note: The thing is that the config needs to be updated runtime
What are the acceptance criteria
rootStore.state.config
should still work for backward compatibilityrootStore.state.config
replaced by this new fancy moduleThe text was updated successfully, but these errors were encountered: