Fork me on GitHub
#helix
<
2021-05-07
>
Aron08:05:49

I have an issue that I don't know what to do with. https://material-ui.com/components/autocomplete/#combo-box check that they rely on the ordering of the props

<TextField {...params} label="Combo box" variant="outlined" />
anything passed after ...params overwrites what params had with the same name. How can I do this with helix?

Aron08:05:53

I think I can do js/Object.assign but the more I think about it the more I want to avoid the whole issue, this shouldn't be needed

teh0xqb12:05:06

I replied to your question below (not threaded)

Aron12:05:05

I am not sure, if you did.

Aron12:05:17

In fact, I am sure you did not.

teh0xqb12:05:49

Helix supports & and :& props spread notation!

teh0xqb12:05:40

See dynamic props section ^

Aron12:05:10

@quilesbaker as I explicitly stated in my question, it is important to notice that the order in the example is not the same as the one used by the spread macro, which I was using already, btw.

Aron12:05:54

would be nice to have an online playground to try it out though, as far as I can remember, if I didn't put the & args pair at the end, it didn't work

Aron14:05:31

and now I am having an even weirder problem, a maxWidth prop only works if I pass it as string, if I pass it bound to a symbol, then it doesn't. I feel like i need some days off.

dominicm14:05:28

@ashnur Are params coming in as a cljs map via bean? Could you just do ($ TextField {:& (merge params {:label …})})? Or maybe use bean itself?

Aron15:05:18

this worked 😄

lilactown15:05:14

helix's spread props and props conversion to a JS object only works on the first level of the TextField props map. so the :InputProps needs to be handled just like you did

lilactown15:05:20

by passing a JS obj

lilactown15:05:55

I think the advice here was right based on the info given. that context was missing

Aron16:05:06

rights and wrongs are decided on another level than what it means to me then, because to me it just felt like a rtfm