Open ikitommi opened 2 years ago
partial
?
out of these, I would prefer 3, then 4, both 2 & 1 seem hacks to me.
(dev-tools/start!
{:state-atom re-frame.db/app-db
:panels-fn {:permissions {:label "Permissions" :fn (partial permissions-view {:permissions #{:a :b}})}}})
(dev-tools/start!
{:state-atom re-frame.db/app-db
:panels-fn {:permissions (permissions-panel-info {:permissions #{:a :b}})}}})
(dev-tools/start!
{:state-atom re-frame.db/app-db
:panels-fn {:permissions {:label "Permissions" :fn [permission-view {:permissions #{:a :b}}]}}})
;; rename keys
(dev-tools/start!
{:state-atom re-frame.db/app-db
:panels {:permissions {:label "Permissions" :view [permission-view {:permissions #{:a :b}}]}}})
(dev-tools/start!
{:state-atom re-frame.db/app-db
:data {:permissions #{:a :b}}
:panels-fn {:permissions {:label "Permissions" :fn permissions-view}}})
:fn
as is, and adding :view
.I wonder if I had some reason why the option is panels-fn
now, and the value must a function...
Might be related to the preload
namespace, where the options need to be declared on compiler options.
currently the panel-functions are 0-arity. To write reusable panels, there should be a way to pass parameters to them. Few suggestions:
1) pass the start! options to panels
2) like 1, but just one key, e.g. :data
3) something else