Fork me on GitHub

ok, next video: 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).


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>)


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


Ah, thanks 🙂


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?


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


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)


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


Is it possible to use javascript react components from within


@tyler Possible, yes. I tend not to.


im building an 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?


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?


@williballenthin not exactly an answer, but you might try the query->ast function on some of your queries:


that should give you some examples


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.


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


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


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


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


@danielstockton that did it! thanks for the pointer.