๐ฆ
If I want a set of components that I can reuse with dynamically configured values (so not reuse by hand, but right now I have a hashmap with keywords as keys and Components as values, but I made the mistake to just do {:typename #($ SelectInput {:pre "defined" :pro "ps" :& %)}
which makes the props js values so it's a mess)
I figured I can just ($ (keyword-for-component the-above-hashmap) {:dynamic config})
But it's not this simple
should I try to use macros instead?
I think that the $
expects a symbol in the first position
whatโs wrong with:
(defnc ConfiguredSelectInput
[props]
($ SelectInput {:pre "defined" :pro "ps" :& props}))
?this might help too: https://github.com/Lokeh/helix/issues/41
Nothing wrong with it, just when I use it, the {:key value} stuff is wrapped in #js
, I might've read about this in the docs
Oh, I misread the question, let me think about your suggestion
Yeah, that issue is what I was remembering, but couldn't find it ๐
But you are right, seems that I over-engineered it (although engineering is not the right word), I also confused :& with &
you may use either :&
or &
Hmm, so I didn't confuse it, it's something worse ๐
@lilactown figured out why it didn't work ๐ I was doing ($ CompName {:somekey { :nestedkey value & restprops}})
I guess I need merge
for that
thatโs right, it only does a shallow merge
So, I found a situation where :& and & still don't seem to be the same:
(defcard AssetSelect
"Select Asset type from the list"
(fn [state _]
($ AssetSelectControl {:set-asset-type (fn [asset-type]
(swap! state assoc :asset-type asset-type))
:& @state}))
state
{:inspect-data true
:history true
:frame false
:heading false})
this puts the state under the key :&
, but if I use &
, then it merges
state is just (def state (atom {}))
so I can share state between devcards
are you using the latest version of helix?
0.0.10
https://github.com/ashnur/helix-q made a minimal repo and was able to reproduce it
I suspect I am doing something wrong : )
found the bug!
thanks for reporting
https://github.com/Lokeh/helix/commit/45c9cdf4c93ba81f178be43c6bc69ffcd3c7b505
It was more of a case of asking for help, but I am glad it was not entirely selfish : )