Fork me on GitHub
#om
<
2017-08-06
>
levitanong02:08:50

@cjhowe We’ve built something with oracle, even. Oracle itself is a nightmare, but we’ve made it work. You can run the parser in the backend. For a great example, see here: https://github.com/anmonteiro/om-next-fullstack

claudiu05:08:38

@cjhowe Working on a project with mysql, no idea about datomic but compared to graphql where you write strings I really love om-next queries and full stack story. Om-next is a bit harder to grasp, but think it's really worth it in the long run (I'm going with fulcro).

cjhowe06:08:54

ah yes, i heard about fulcro earlier! it's definitely a good project to help with grasping om-next

claudiu09:08:27

personally like it more. Having queries as read only from local db, seems like a nicer flow, that easier to reason about/debug. Initial state + helper functions make the developer experience a lot nicer 🙂

claudiu09:08:37

can do that in om-next, but then again, since I like it and it's already written, tested & extensively documented. No point in reinventing the wheel.

claudiu09:08:33

@cjhowe regarding you question with mysql/datomic. There is also a section in fulcro getting started with examples on how to use it with legacy 'restfull' endpoints (should apply to om-next also).

luchini14:08:51

I’ve been doing a considerable amount of research over Om-next because the concepts in there are brilliant and potentially great in my line of business.

luchini14:08:51

I did trip big time recently on something that didn’t seem very clear to me and my team. It seems to be some deep architectural decision that escaped me initially. It spawns out of this on the source: https://github.com/omcljs/om/blob/master/src/main/om/next.cljc#L1589

luchini14:08:04

> “`transact!` should be called on a component that implements IQuery or has a parent that implements IQuery

luchini14:08:39

But here’s where it can get confusing. We have a parent that does implement IQuery and a few children that also implement IQuery. The parent’s query is defined combining a series of om/get-query

luchini14:08:45

In that scenario, if a transact! is triggered from one of the children, the query sent to the parser will be based on the child’s query instead of the parent’s.

luchini14:08:10

As a user of Om next, there are 3 alternatives to deal with it:

luchini14:08:46

1. Have an intermediate component between parent and children that does not implement IQuery (it seems to be the way in most tutorials and examples)

luchini14:08:15

2. Pass a reference to the parent down to the children and make sure transact! is being called on the parent instead of this

luchini14:08:56

3. Use get-reconciler on the children components to get the root reconciler to pass to transact!

luchini14:08:14

I’m not totally sure these options really make much sense when explaining Om next to others

luchini14:08:52

Am I doing something wrong? Did I miss something here? What are your thoughts?

claudiu15:08:59

@luchini I usually have actions in the parent and send them to children through om/computed. So basically most of the children are dumb in regards to actions.

claudiu15:08:10

or if you want a refresh on a high level parent component, just add one of the keys the parent has in it's query in transact and it will get updated.

luchini15:08:23

Interesting @claudiu. I was not familiar with computed. This is an interesting approach.

luchini15:08:16

It does require a bit more of wiring though and reusability of the child component is now dependent on the interface provided by the parent through the computed props

luchini15:08:58

I wouldn’t personally mind the mutation query leaking down to the child component because supposedly that’s the main abstraction point anyway (the same way that the IQuery of the component is an abstraction in itself)

luchini15:08:49

Do you do it this way just to avoid this particular issue or do you have other uses too?

claudiu15:08:59

that's the way I usually do it in javascript also. Not om-next particular.

claudiu15:08:10

For example: listing of articles, with delete option. If I use the article component in 3 different listings, the delete functionality might be different. The listing element should not know about it's context, it just gets a onDelete.

luchini15:08:28

Yes. I’ve done that in JS a lot. I was hoping om-next would remove the need for that abstraction (by having its own separate abstraction system) 😄

urbank15:08:20

@luchini This might be a bad idea, but you could pass a partially applied transact to the child component

urbank15:08:05

partially applied to the parent component (partial om/transact! parent-this)

luchini15:08:34

True… 🙂 It’s like option 2 above… but fancier 😄