Open kiyui opened 7 years ago
Reducer approach (make current code more efficient):
make_helper
factory that already has add
, update
, delete
reducers that can handle additional use-cases where just removing the child widget is not good enough. These reducers are similar enough to snabbdom
modules, though in a sense much more limited.widgets
object to reducers because it may encourage sloppy codingprops
from reducers
so checking is faster.Module approach (rewrite everything):
performPatch
and destroyWidget
functions, perhaps I can represent the data in the following form without any deep hierarchies so determining add
, update
, or delete
is just a matter of running a diff.
{
'#container': { ...options },
'#button': { ...options}
}
performPatch
calling the reducer stored inside the child, we call modules that perform the side effects instead.StackSidebar
child does not run the default module that uses add
instead of attach
instead for example.make_helper
in this case will just pre-define which modules it is compatible with
Currently the way patching works is by making the
h()
function return reducers that will patch widgets stored in thegtkDriver
.As can be seen in #1, even very basic tasks already require custom use-case reducers via overloading a
addReducer
property inh()
and I can imagine a use case for anupdateReducer
in the future.Validations required:
widgets
andwidgetsProxy
storage ingtkDriver
robust enough to handle potential issues in the future?StackSidebar
that handle all the custom reducers that may be required?patch
function sufficient for a higher-order helper to infer how it should patch the widgets?