untangled

NEW CHANNEL: #fulcro
mitchelkuijpers 2016-09-27T06:43:56.001249Z

@tony.kay Thank you so much for the explanation, I think I am going that way. Definately deserves a blogpost

mitchelkuijpers 2016-09-27T19:23:44.001278Z

Is it correct that the :marker true options blows away any state you have in that part of the application? For example when I do a query on and run load-data:

:confluence.autocomplete/spaces [:ui/fetch-state
                                 :total
                                 {:results (om/get-query Space)}]
It will blow away :results and :total when loading and resets them when loaded. I fixed it by making a post-mutation which moves the options somewhere else and I render from there (so that I don’t lose the current resultset when it is loading a new one). Is this the way you are suppose to fix this or did I stumble upon a bug?

tony.kay 2016-09-27T20:04:05.001281Z

So, in general when you are loading data you should understand that the data you're targeting is to be overwritten.

tony.kay 2016-09-27T20:04:17.001282Z

when you use markers, then yes, it overwrites teh data with the marker

tony.kay 2016-09-27T20:05:14.001283Z

post-mutation is exactly how to handle this.

tony.kay 2016-09-27T20:06:17.001284Z

The idea of marker is so you can show a "loading" or spinner in place of the real data. There is a global loading marker at [:ui/loading-data '_] (I think that is the name) that is for showing a "network xfer in progress" kind of thing in a non-localized position

tony.kay 2016-09-27T20:07:05.001285Z

So, if you want the results to stay in place, use :marker false

tony.kay 2016-09-27T20:07:59.001286Z

If you want some combo (e.g. a localized loading marker, but the results to stay in place) then have your mutation create your own kind of localized marker that you clear in post-mutation. All sorts of ways to solve it. The load markers (global and local) are a convenience for the common two cases (network xfer in progress, and "please wait while I fetch that, but I have nothing yet").

tony.kay 2016-09-27T20:09:27.001288Z

^^^ @mitchelkuijpers

mitchelkuijpers 2016-09-27T20:10:30.001289Z

Yeah that is what I am currently doing, works fine

mitchelkuijpers 2016-09-27T20:10:42.001290Z

Just making sure I am not fighting untangled

tony.kay 2016-09-27T20:10:54.001291Z

sure

tony.kay 2016-09-27T20:14:37.001292Z

The general pattern is: db -> UI render -> event -> mutations/fetches (modify db, possible send remotes) -> UI render -> network completion (db change) -> optional post-mutations (db change) -> UI render repeat

tony.kay 2016-09-27T20:15:30.001294Z

Since the UI render is supposed to be a ref transparent rendering (for the most part) all you're really managing is the shape of the data and queries

mitchelkuijpers 2016-09-27T20:16:23.001295Z

Now that I got you here do I ever need to add refreshes or reads in mutations for :ui/fetch-state or ui/data-loading

mitchelkuijpers 2016-09-27T20:16:45.001296Z

Copied you're general pattern that’l come in handy

tony.kay 2016-09-27T20:16:55.001297Z

I'm not sure I understand

tony.kay 2016-09-27T20:17:13.001298Z

oh I see

tony.kay 2016-09-27T20:17:39.001299Z

Om will put the components that trigger network requests in the queue of things to re-render

tony.kay 2016-09-27T20:18:00.001300Z

and on post-mutation we actually force a global render (if I remember right...we change the react-key)

tony.kay 2016-09-27T20:18:11.001301Z

so, it should "just work"

mitchelkuijpers 2016-09-27T20:18:41.001302Z

Ah cool, I thought that was the case

tony.kay 2016-09-27T20:18:53.001303Z

yeah, if they don't update I'd consider it a bug

mitchelkuijpers 2016-09-27T20:19:40.001304Z

Ok

mitchelkuijpers 2016-09-27T20:21:03.001307Z

Btw if anyone runs into weird subvec errors with om 1.0.0-alpha45 you should upgrade to 1.0.0-alpha46 I got bitten by this bug a lot: https://github.com/omcljs/om/pull/767

tony.kay 2016-09-27T20:21:33.001309Z

thanks for the heads-up

mitchelkuijpers 2016-09-27T20:22:00.001310Z

This was the reason I was asking about add-root! and remove-root! because I got this error when I removed a root

mitchelkuijpers 2016-09-27T20:22:41.001311Z

They did a lot of fixes in the new version I guess they are working towards the first beta

tony.kay 2016-09-27T20:24:13.001312Z

It will be soooo nice to have a beta

tony.kay 2016-09-27T20:24:41.001313Z

not been that big of a deal, but the "is this a bug or the way it should work" has been a bit of a pain

mitchelkuijpers 2016-09-27T20:24:51.001314Z

Yeah same for me

mitchelkuijpers 2016-09-27T20:25:06.001315Z

And they bugs are pretty damn hard to figure out (if you even figure them out)

tony.kay 2016-09-27T20:25:40.001316Z

fortunately the core stuff has been relatively stable. We've only lost a few total days of productivity on that kind of thing in months

mitchelkuijpers 2016-09-27T20:25:59.001317Z

Yeah untangled kinda abstracted all the annoying stuff away

mitchelkuijpers 2016-09-27T20:26:33.001319Z

The unions stuff with the InitialAppState is pretty insane btw

mitchelkuijpers 2016-09-27T20:26:36.001320Z

works like a charm

mitchelkuijpers 2016-09-27T20:27:14.001321Z

My first stuff with unions and om.next took me 2 days :lol:

mitchelkuijpers 2016-09-27T20:28:34.001322Z

Well I’ll be off, thnx for the help @tony.kay (again)

mitchelkuijpers 2016-09-27T20:33:53.001323Z

http://untangled-web.github.io/untangled/reference/reference.html#_overall_network_plumbing found an image of what you were talking about I somehow missed this earlier

tony.kay 2016-09-27T21:32:56.001326Z

Funny...I forgot I even did that diagram

tony.kay 2016-09-27T21:33:35.001327Z

and glad to hear you appreciate the InitialAppState stuff. I was pretty darn happy when that stuff (esp. the Union simplification) fell out

adambros 2016-09-27T21:37:22.001328Z

oh wow i forgot about that reference page let me bookmark that lol

adambros 2016-09-27T21:38:21.001330Z

we should pin it as well

tony.kay 2016-09-27T21:39:00.001332Z

Of general interest: Members of the Untangled Team are doing a week-long documentation sprint next week. We have not identified all of the targets, but it'll be 4-5 people for 40 man hours. We should see some significant improvements.

👍 3
tony.kay 2016-09-27T21:39:14.001333Z

Anyone in the OSS community that wants to join in, let me know!

adambros 2016-09-27T21:39:43.001334Z

http://untangled-web.github.io/untangled/reference/reference.html This reference guide is meant to be an indexed document for quickly finding information about the Untangled Web Framework. If you’re trying to learn Untangled, then you should do the https://github.com/untangled-web/untangled-tutorial

tony.kay 2016-09-27T21:40:45.001337Z

So far it'll be me, @mahinshaw, @adambros, @ethangracer, and our tech editor.