Fork me on GitHub
#om
<
2018-06-07
>
danielstockton07:06:34

My first thought would be to return an id for reading the result in the future. Then you could customize your merge fn to recognize there are asynchronous results and start polling.

danielstockton07:06:43

It's definitely possible, but I don't know of any examples.

Adam Bubeníček08:06:30

Interesting, why do you think merging would be necessary? I thought no outside state needs to be involved, just the final tree of data composed by a recursive parser.

Adam Bubeníček08:06:03

You gave me an idea though, what if :read fn returns {:value async-channel-with-val}, and then I just wrap parser function to loop through map values, see if they are channels and wait for their resolution (and return channel itself). In theory that could work recursively too. Not very good with core.async yet, but I’ll try to put it together

danielstockton09:06:24

The final tree of data will not be final in your case, it will contain placeholders for things that appear later

danielstockton09:06:41

You'll need a way to trigger a re-read on components after the data is available, which is where merge comes in

wilkerlucio13:06:43

@adambubenicek pathom has full async support if you need it, so I think can get a good head start there

👍 8
danielstockton14:06:19

Indeed, I was describing a different kind of async, if waiting isn't an option

wilkerlucio14:06:51

I just don't recommend using pathom as your client parser (the one that runs in the reconciler, the base parser) because it probably will be slow for that, pathom is more focused on remote parsers (that can serve your 'sends' from local, or on the server, node.js or clojure)

👍 4
Adam Bubeníček14:06:18

Pathom does look very good. Frankly, I wanted to start with something smaller and simpler (om next appears to be), mainly to learn. But in the end I probably should use Pathom (+ Fulcro). Thanks!

👍 4
wilkerlucio17:06:53

@adambubenicek to be honest, I think Fulcro is simpler than Om.next, it can look scary on the outside because it seems like "more stuff", but it gets you ahead in a lot of things that require manual implementation in om.next, like the local parser

🙂 16