Fork me on GitHub
#om
<
2017-01-26
>
tony.kay00:01:20

ok, next video: https://youtu.be/uxI2XVgdDBU How to build reusable components in Om Next/Untangled. Includes an automated tool for converting HTML to React (in the references github source), tips about Chrome, local reasoning, visual development with devcards, making mutations more usable in IntelliJ (doc strings and "jump to" navigation).

linuss09:01:09

Hey guys, I'm trying to achieve something, but I can't seem to get it right. I'm writing a small application to store and edit forms using Om.Next and DatasScript. I'm running DataScript in the backend to store the forms. In the front-end, I'd like to display a list of form id's, and when one is clicked/selected, the corresponding form. My problem is that I can't seem to query both all form ID's and all the data from a single form using the same pull syntax. To get all the id's, I have to do something like (d/q '[:find ?id :where [_ :form/id ?id]) (d/db conn)), while to get all the fields from a single form, I have to do something like (d/pull (d/db conn) '[*] <eid>)

danielstockton09:01:31

@linuss I recommend trying in #datascript or #datomic, it's not really an om question.

linuss09:01:11

Ah, thanks 🙂

linuss11:01:34

So, i'm looking at some Om.Next example projects, and they seem to use an om/parser both in the front- and in the back-end. Would you guys say this is a good practice?

danielstockton11:01:26

It sure helps @linuss, you don't need to implement your own query parsing (as in, separating out all the different reads and joins).

linuss11:01:59

Okay, I see. It does seem rather cumbersome having to parse a query twice though (once in the front-end and then again in the back-end)

linuss11:01:32

Although I suppose the front-end functions could simply pass their queries on to the back-end

tyler15:01:12

Is it possible to use javascript react components from within om.next?

danielstockton20:01:22

@tyler Possible, yes. I tend not to.

williballenthin20:01:05

im building an om.next interface for a json api. i've written a read parser that works against the client-side app state, and also collects the idents that it cant resolve. i was thinking of using this set of idents to trigger requests to the json api to lazily fetch the data needed. is this a reasonable approach?

williballenthin20:01:40

i've tried returning something like the following from the read parser:

{:value everything-found
   :hg-remote set-of-missing-idents}
and understood this would fire my send function with the missing idents. the send function does fire, but not with the set of idents (often nil). so i can't quite figure out what i'm allowed to put as set-of-missing-idents. from the documentation, i see that its supposed to be ast fragments, but i think i haven't quite got the structure right. can anyone point me to an example of this structure?

danielstockton20:01:44

@williballenthin not exactly an answer, but you might try the query->ast function on some of your queries: https://github.com/omcljs/om/wiki/Documentation-(om.next)#query-ast

danielstockton20:01:03

that should give you some examples

williballenthin21:01:53

thanks @danielstockton, i'll use that function as an example and ensure i'm passing an ast that looks just like what query->ast would produce.

tony.kay21:01:56

@tyler Yes, and it is useful. I use, for example, D3 and Victory charts

tony.kay21:01:07

both have cljsjs jar files which makes them even easier to use

tony.kay21:01:02

the first shows d3, the second Victory. The former isn't react, just raw JS D3. The latter is raw react

tony.kay21:01:34

Untangled is just a set of libraries that give you additional things to use with Om Next, so the UI stuff is stock Om for the most part

williballenthin21:01:57

@danielstockton that did it! thanks for the pointer.