Description
Currently, all logic related to state.Provider (the bind and stateProvider_ configs, the getStateProvider() method, etc.) resides entirely within src/component/Base.mjs.
The base class for functional components, Neo.functional.component.Base, extends Neo.component.Abstract but does not extend Neo.component.Base. This architectural separation prevents functional components from accessing and using state providers, which is a key feature for v10.
The createVdom method signature in functional.component.Base was already updated to anticipate access to provider data via config.data, making it clear that this functionality is intended.
Task
To solve this, we need to refactor the state provider logic out of component.Base and move it up the inheritance chain into component.Abstract. This will make the state provider system available to both classic class-based components and modern functional components.
Key Logic to Move
The following configs, methods, and lifecycle logic must be moved from src/component/Base.mjs to src/component/Abstract.mjs:
- Configs:
bind
modelData
stateProvider_
data_ (the convenience getter)
parentComponent_ (dependency for getConfigInstanceByNtype)
- Methods:
beforeSetStateProvider()
afterSetStateProvider()
getStateProvider()
getState()
setState()
beforeGetData()
getConfigInstanceByNtype() (dependency for getStateProvider)
- Lifecycle Logic:
- The
stateProvider related calls inside destroy(), initConfig(), and onConstructed() need to be moved.
- Two-Way Binding Logic:
- The logic inside
afterSetConfig() that handles two-way data binding needs to be moved.
Affected Files
src/component/Abstract.mjs (target for new logic)
src/component/Base.mjs (source of logic to be moved)
src/functional/component/Base.mjs to not pass data to createVdom() => performance => access via config.data
Description
Currently, all logic related to
state.Provider(thebindandstateProvider_configs, thegetStateProvider()method, etc.) resides entirely withinsrc/component/Base.mjs.The base class for functional components,
Neo.functional.component.Base, extendsNeo.component.Abstractbut does not extendNeo.component.Base. This architectural separation prevents functional components from accessing and using state providers, which is a key feature for v10.The
createVdommethod signature infunctional.component.Basewas already updated to anticipate access to provider data viaconfig.data, making it clear that this functionality is intended.Task
To solve this, we need to refactor the state provider logic out of
component.Baseand move it up the inheritance chain intocomponent.Abstract. This will make the state provider system available to both classic class-based components and modern functional components.Key Logic to Move
The following configs, methods, and lifecycle logic must be moved from
src/component/Base.mjstosrc/component/Abstract.mjs:bindmodelDatastateProvider_data_(the convenience getter)parentComponent_(dependency forgetConfigInstanceByNtype)beforeSetStateProvider()afterSetStateProvider()getStateProvider()getState()setState()beforeGetData()getConfigInstanceByNtype()(dependency forgetStateProvider)stateProviderrelated calls insidedestroy(),initConfig(), andonConstructed()need to be moved.afterSetConfig()that handles two-way data binding needs to be moved.Affected Files
src/component/Abstract.mjs(target for new logic)src/component/Base.mjs(source of logic to be moved)src/functional/component/Base.mjsto not pass data to createVdom() => performance => access viaconfig.data