untangled

NEW CHANNEL: #fulcro
berkeleytrue 2016-11-22T05:15:53.004781Z

What is the idiomatic way of coming up with idents for components that are only ever on the dom tree once?

berkeleytrue 2016-11-22T05:16:27.004782Z

I’m currently using [:child/by-id “ComponentName”]

adambros 2016-11-22T05:52:43.004783Z

@berkeleytrue iirc :singleton is a pattern ive seen throughout cookbooks and tests

adambros 2016-11-22T05:53:10.004785Z

not sure you’d use :thing/by-id with that though

adambros 2016-11-22T05:53:16.004786Z

as its not really an id...

berkeleytrue 2016-11-22T07:13:08.004790Z

I would want to get away from /by-id

berkeleytrue 2016-11-22T07:13:27.004791Z

So would the ident be something like [:main :singleton]?

berkeleytrue 2016-11-22T07:14:24.004792Z

Is there a reference somewhere for the parser that has a legend of these keywords?

2016-11-22T08:33:39.004794Z

This is more of an om.next question but I figure more people here have experience writing real applications. Does anyone know of any patterns for forcing a remote read or delaying a read until after an event? My specific use case is that I have a mutate that logs a user in and acquires a JWT token and I need to delay or re-run some requests after receiving that token in order to authenticate..

mahinshaw 2016-11-22T16:10:15.004801Z

@danielstockton I’m guessing you are talking out delaying the on-tarted-callbackreads? If that’s the case, you can make a transaction out of those reads, and call that transaction after your auth process.

2016-11-22T16:10:47.004802Z

im actually not using untangled, but i was hoping some patterns may have developed here that i could borrow

tony.kay 2016-11-22T17:14:07.004803Z

@danielstockton There really isn’t a pattern, as such. The thing is that Om Next in general has a specific model for how you model remote interactions. Delaying is an orthogonal concern. You could use setTimeout or something similar.

tony.kay 2016-11-22T17:14:56.004805Z

If you’re talking about possibly triggering another action after a particular network request finishes, then that has a bit more to it in the Om Next model, since the return sequence in Om Next isn’t explicitly defined

tony.kay 2016-11-22T17:15:22.004806Z

well, it is defined, but it is defined by essentially hooks that you can plug into

tony.kay 2016-11-22T17:16:03.004807Z

The only events you have are UI events, end of processing (e.g. return from networking), and anything you make up (e.g. via setTimeout)

tony.kay 2016-11-22T17:16:18.004808Z

UI events…should be obvious what you do there: run transact!

tony.kay 2016-11-22T17:16:38.004809Z

setTimeout…again: keep hold of the reconciler (which in Untangled is in the app), and use transact!

tony.kay 2016-11-22T17:22:21.004810Z

the network pipeline is for you to write, so you plug into that however you see fit…there is more to say about Om Next, but it is along the lines of “you plug that into the merge/migrate mechanisms"

2016-11-22T18:47:11.004814Z

@tony.kay Is there some way to force a remote re-read? I transact and force a re-read, but it doesn't hit the remote. This is my problem.

mitchelkuijpers 2016-11-22T18:53:02.004815Z

@danielstockton This is not related to untangled at all. But this might be interesting for you: https://github.com/omcljs/om/wiki/Documentation-(om.next)#force

2016-11-22T19:00:12.004817Z

@mitchelkuijpers tried that, i don't think its all hooked up yet

2016-11-22T19:00:20.004818Z

i don't see the :target being added to the ast

tony.kay 2016-11-22T19:00:31.004819Z

@danielstockton In Om Next quoting is used to mark AST with remote

mitchelkuijpers 2016-11-22T19:00:46.004820Z

Oh I am pretty sure that works, did you add a ~?

tony.kay 2016-11-22T19:00:50.004821Z

e.g. [‘:thing] implies you want a remote read

tony.kay 2016-11-22T19:01:07.004822Z

there is a helper function as well that let’s you say which remote

tony.kay 2016-11-22T19:01:15.004823Z

then you implement that in the parser.

tony.kay 2016-11-22T19:02:02.004824Z

in Untangled, we have all of that pre-coded so the loading story is clear…no parser emitting code required

2016-11-22T19:02:28.004825Z

(om/transact! component
        `[(user/login {:username ~username :password ~password}) ~(om/force :totals :api)])

tony.kay 2016-11-22T19:02:41.004826Z

that’s unquoting

tony.kay 2016-11-22T19:02:50.004828Z

ah yes, force

tony.kay 2016-11-22T19:02:57.004829Z

That’s the helper

2016-11-22T19:04:05.004830Z

I can't get it to work, or at least not as expected. I'm checking the read function and expecting the ast to have :target :api

tony.kay 2016-11-22T19:04:12.004831Z

this is definitely more of an #om discussion…all of these complications aren’t necessary with Untangled

2016-11-22T19:04:43.004833Z

Yeah, I had no luck there earlier, but I'll try again.

tony.kay 2016-11-22T19:05:04.004834Z

we’re just going to tell you to use Untangled 😉

tony.kay 2016-11-22T19:05:22.004835Z

soooo much easier, with pretty much all of the benefits

2016-11-22T19:09:44.004836Z

It might be, I'm probably re-implementing a lot of things it solves, but it's a good learning exercise to discover them for myself.

tony.kay 2016-11-22T19:10:12.004837Z

Yep. I’ll look forward to PRs dolling up Untangled internals in a few months 🙂

2016-11-22T19:11:59.004838Z

Is untangled opinionated about the server-side? I'm dealing with a django application on the backend.

tony.kay 2016-11-22T19:14:14.004839Z

It’s easier if you use the server side. The SNAPSHOT version of server was just refactored to pull apart the bits so you can build it into your own web server.

tony.kay 2016-11-22T19:14:18.004840Z

you hitting REST APIs?

tony.kay 2016-11-22T19:14:42.004841Z

seems like you lose a lot of the benefits if you don’t at least have a core API endpoint in Clojure

2016-11-22T19:14:50.004842Z

no, i actually wanted to write a parser for the om query syntax and have a single endpoint, with a few exceptions

tony.kay 2016-11-22T19:15:04.004843Z

yeah, Untangled has you do exactly that

tony.kay 2016-11-22T19:15:10.004844Z

you have to provide an Om parser

tony.kay 2016-11-22T19:15:22.004845Z

but it handles the network plumbing API endpoint

2016-11-22T19:15:29.004846Z

i managed to get some way in python using python-transit

2016-11-22T19:15:41.004847Z

I'll have to look into it

tony.kay 2016-11-22T19:16:33.004848Z

The primary things we handle for you on the server are catching exceptions, wrapping up tempid remaps, and a few other trivial things. Stuff you’d have to write yourself, but it’s just not a lot

tony.kay 2016-11-22T19:16:47.004849Z

as long as you’re using transit

tony.kay 2016-11-22T19:17:35.004850Z

We still need to write docs on our new server stuff that’s been teased apart. But yeah, if you’re using python on the server you’d have to write a query parser

👍 1
adambros 2016-11-22T19:39:57.004851Z

untangled server @ 0.7.0-SNAPSHOT has docstrings on the new untangled-system function for building a server once I have some time this week I will be porting untangled-template to use it, and adding some docs to the devguide

2016-11-22T19:41:31.004853Z

Ok, i'll keep an eye out, I definitely need to dig into untangled more