untangled

NEW CHANNEL: #fulcro
pedroteixeira 2017-05-24T01:20:57.616561Z

@currentoor sorry, I meant url routing. I think I saw somewhere someone solving on the parser (query would return something conditionally on current route for ex) rather than using union queries on top component. still digging into design patterns here, still unsure on best way to go for current proj with cljs+react. I thought about implementing UntangledApplication, to better underestand Om.next first

mitchelkuijpers 2017-05-24T15:17:28.468107Z

So I am looking at untangled-ui is it safe to use the form support? Because I need get some forms done and I like how it works

mitchelkuijpers 2017-05-24T15:19:44.524705Z

I already have it working with this component: https://atlaskit.atlassian.com/components/field-text loving how it works so far

fz 2017-05-24T15:37:07.965801Z

Wrapping my head around union queries β€” I'm picturing two "modes" of tabbed interfaces: β€’ Scenario A: Data for each tab is assumed "independent"; they can coexist in the database either up-front or as the user navigates between tabs β€’ Scenario B: Tabs are mutually exclusive (radio-button semantics), where each tab loads a different query but loading one means the other is "inactive"/"invalid" Am I correct in thinking that union queries only apply in the former case? Concrete example: Suppose I'm at a subtree in my database. The data here can either look like {:due-date {:date #inst 'foo}} or {:due-date {:vague :later-today}}. If the data (loaded from server) looks like the former, I'd render a date picker. Otherwise, if the data looks like the latter, I'd render a <select>. In this case, I'd use regular conditional logic rather than a union query?

gardnervickers 2017-05-24T15:40:22.045777Z

@fz No union queries apply to both cases

fz 2017-05-24T15:43:56.132940Z

Ok β€” in all the examples there is some sort of :tab-type field in the initial state of the tab components which is used to power the union ident. In this case, I'd drive that ident by inspecting the subtree fields, right?

gardnervickers 2017-05-24T15:46:21.191175Z

No the :tab-type field would be derived for you during normalization. In your union ident you'd specify something like [(:tab-type props) (:id props)]

gardnervickers 2017-05-24T15:46:49.202907Z

Then in your render method, you'd dispatch on (:tab-type props).

gardnervickers 2017-05-24T15:47:02.207971Z

Not sure what you mean by the subtree fields.

gardnervickers 2017-05-24T15:47:35.221744Z

Not sure where in the tree you're talking about is all πŸ˜„

fz 2017-05-24T15:48:37.246643Z

That makes sense. But in this case, how would the value of :tab-type get set in the first place? Concrete example: Suppose I'm at a subtree in my database. The data here (loaded from server) can either look like {:due-date {:date #inst 'foo}} or {:due-date {:vague :later-today}}. If the data here looks like the first case, then :tab-type would be :specific. Otherwise, :tab-type would be :vague.

fz 2017-05-24T15:48:59.255730Z

More broadly, in this scenario, :tab-type is "determined" by the shape of the data, not the initial UI state

gardnervickers 2017-05-24T15:49:14.261856Z

So for your specific example, you'd have something like {:due-date-type :date :date #inst} and {:due-date-type :vague ...}

fz 2017-05-24T15:50:04.282298Z

Ah, so I'd have to be explicit about the type, rather than implicitly deriving it

gardnervickers 2017-05-24T15:50:04.282347Z

Then (assuming there's an id field there too), your ident would be [(:due-date-type props) (:id props)]

gardnervickers 2017-05-24T15:50:47.300848Z

I mean you can totally derive it using the (om/ident) function

gardnervickers 2017-05-24T15:50:54.303791Z

I wouldn't as it adds some confusion

πŸ‘ 1
gardnervickers 2017-05-24T15:51:49.326991Z

Plus you'll have to derive it all over the place, in your mutations, in your render function, etc..

gardnervickers 2017-05-24T15:51:57.330503Z

Much easier to derive once and just stick it into the app state.

fz 2017-05-24T15:52:26.342348Z

Good call, thanks

tony.kay 2017-05-24T17:49:52.991781Z

@mitchelkuijpers safe is a relative term πŸ˜‰

tony.kay 2017-05-24T17:50:11.998690Z

it should be relatively stable, if that’s what you mean.

mitchelkuijpers 2017-05-24T17:51:22.025229Z

@tony.kay that was what I meant πŸ˜‰

mitchelkuijpers 2017-05-24T17:52:20.046735Z

That's good news

2017-05-24T18:26:13.807730Z

@mitchelkuijpers I started again with my untangled project yesterday and I’m using the untangled-ui components and the forms support. So far I’m very happy with that.