Fork me on GitHub
#om
<
2017-11-10
>
Desmond01:11:41

Hi im trying to set up om next with a remote api backed by datomic in a way where i can run the same datalog queries in the browser or on the server. Somehow i got the impression that this would be possible and is even an intended use case thanks to datalog. Its a beautiful idea im just struggling to get it working in the real world. Has anyone done this? Also could anyone point me to some publicly accessible sample code?

Desmond06:11:17

I realized my mistake was that im not using the pull syntax

ajs12:11:15

I've been using Om Now on an enterprise project for three years. Now evaluating more modern tools for migration/updating of the project, including reagent, reframe, Om next and rum. Can anyone comment on why you chose Om Next as your library for React?

sundarj12:11:08

@ajs the model is very simple, and imo rather elegant. i also found it pretty easy to learn. Fulcro (https://fulcrologic.github.io/fulcro ; based on Om Next) is fantastic as well

ajs12:11:33

Reagent also seems pretty easy

ajs12:11:44

But Om is more explicit, and I prefer that

sundarj12:11:29

reagent/re-frame are easier for sure (hence their popularity), but om next is simpler

sundarj12:11:53

depends what your priorities are

ajs12:11:15

I see you are making a distinction between easy and simple

sundarj12:11:19

if you haven't seen this yet: https://www.infoq.com/presentations/Simple-Made-Easy i highly recommend it

sundarj12:11:39

it's rich hickey's best talk imo, and it's a big part of the reason i decided to learn clojure

ajs12:11:06

Have indeed seen it

sundarj12:11:19

ah, great 😁

sundarj12:11:27

indeed 😉

sundarj12:11:39

om next is rather more opinionated, and thus not as familiar. so there is that initial leap, which makes it less easy

ajs12:11:07

Haven't read the fulcro docs yet but I went thru the Om Next tutorial and it seemed straightforward, yet I read that fulcro adds the missing pieces. What would this missing pieces be?

sundarj12:11:13

om next is a bit low-level and customisable, which means there is quite a lot of boilerplate and plumbing required to use it directly. fulcro makes a lot of decisions for you, and removes that boilerplate/plumbing

sundarj12:11:59

fulcro also provides things like routing, networking, colocated initial state, colocated css, and i18n for you

ajs12:11:00

In reagent I don't like that there is a lot of implicit ambiguity. I think Om Next follows Om Now in being explicit? In reagent, an argument can be a prop, or a child, or neither, just a fn arg for other purposes. I suppose at run time reagent is having to always figure out how to treat args.

sundarj12:11:00

yeah i would not use reagent directly. re-frame seems decent enough though

ajs12:11:41

What is i18n?

sundarj12:11:57

internationalization; support for multiple languages

ajs12:11:12

One thing I like about reagent/reframe is that if two or more components need the results of the same query or calculation, it is only done once and then delivered multiple times. Haven't poured enough into Om Next queries to know if something similar happens there.

ajs12:11:48

I'm guessing not since queries are mainly just a way to access data but calculations would be separate from that.

sundarj12:11:43

yep that is how om next queries and mutations work too, if i understand you correctly

ajs12:11:21

Cool, still some learning to do there

ajs12:11:51

What's the best source for good tutorials in Next?

sundarj12:11:27

the Om wiki is good, and the Fulcro Getting Started and Dev guide

sundarj12:11:04

since Fulcro is based upon Om Next, much of the Fulcro docs applies to stock Om Next

claudiu13:11:23

@ajs Fulcro also has some great getting started videos 🙂

ajs21:11:19

Why is increment in parens here, from the Om getting started: (om.next/transact! reconciler '[(increment)])

ajs21:11:40

The mutation looks for a key of just 'increment, quoted.

ajs21:11:25

But that looks like a fn call

sundarj21:11:31

@ajs that is just how transactions look. you can also pass them params like '[(mutate {:a 1}) (other-mutate {:b 2})]

ajs21:11:35

Ok guess I'll need to see more sample apps

sundarj21:11:46

they do look like function calls, but are just data

ajs21:11:12

The entire contents of the paren is the single key?

sundarj21:11:46

the mutation key and the transact mutation syntax are distinct things

sundarj21:11:18

(-> '[(foo)] first first)
foo

(-> '[(foo)] (conj '(bar)))
[(foo) (bar)]