Fork me on GitHub
#om
<
2015-12-22
>
dnolen00:12:53

@firinne: you’re probably trying to tackle a bit too much all at once

dnolen00:12:06

I would focus on solving each problem in isolation first

dnolen00:12:23

getting the bits to connect is usually trivial if you can accomplish the former

dnolen00:12:42

first just try to deploy Ring app by itself

dnolen00:12:53

then try to deploy Ring + Datomic as a data service

dnolen00:12:05

then try to deploy some trivial ClojureScript bit

dnolen00:12:21

finally try to hook up Om

dnolen00:12:49

if you’re just starting out and you try to do everything at once your unlikely to succeed

firinne00:12:55

yeah that’s my approach right now

dnolen00:12:59

even experienced Clojure developers would have trouble sorting through all of this

firinne00:12:34

I’ve gotten all working except having different urls for production and local with my uri for the datomic db

dnolen00:12:50

so then when discussing your problem

dnolen00:12:56

leave out all the parts that don’t matter

dnolen00:12:10

otherwise people who might have the answer won’t help

dnolen00:12:26

because they will be confused by irrelevant details

firinne00:12:31

Well, the bigger question I was trying to ask about is whether there exists any kind of a roadmap for someone willing to put the time in to learn all these things. There is no sign that says, if you would like to use datomic in production you will need to learn how to use components. The main thing I’m trying to figure out isn’t so much the answer to this one question, but rather whether there are guideposts to help me find out whether I’m even asking the right questions.

firinne00:12:16

I understand how the details may not answer the specific question though.

dnolen00:12:13

@firinne: no there’s nothing like a roadmap

dnolen00:12:39

all this stuff is very new (Datomic + Client-centric approach) - so you’ll be adventuring with the rest of us

firinne00:12:55

Then I suppose the next question would be — assuming I am able to figure out the answer to the next set of challenges — and I am able to document the path I have taken to get from zero to something, where might I place that map so that others could improve it/critique it/benefit from it.

dnolen00:12:33

@firinne: there’s some discussion about a new Om cookbook

dnolen00:12:07

nothing definitive yet, but the idea is brewing - I wouldn’t recommend pursuing very serious doc efforts until we get to beta however

dnolen00:12:27

otherwise likely to document something that might change

firinne00:12:35

yeah I’m just trying to doc prereqs right now

firinne00:12:47

like — deploying ring/datomic

dnolen00:12:14

right that stuff may or may not be relevant for Om Next cookbook

dnolen00:12:33

people use things other than Ring

dnolen00:12:18

but once we’re on the other side of beta - that would be a good time to write all kinds of tutorials / books

dnolen00:12:30

efforts that don’t necessarily need to make it into any standard docs

firinne01:12:27

@dnolen: awesome. hopefully will be able to contribute by that time. Also, thanks for the feedback on focusing the question — was able to get an answer that solved my problem in the beginner channel 😉

kahunamoore03:12:03

@firinne: for some Om Next, ReactNative and related content, check out some of the work Mike Fikes (and others) have done here: http://cljsrn.org

not-much-io09:12:13

Hey everyone, question: When looking at using Om, any suggestions for UI component libraries (bootstrap, material design lite etc. kind of libraries) ? I would think avoiding libraries that use JQuery would be reasonable for one thing? Are there some libraries that are a very good fit for Om (made for React maybe)?

a.espolov13:12:00

use 1.0.0-alpha28 mutate fn throws exception Uncaught Error: Assert failed: app/route mutation :value must be nil or a map with structure {:keys [...]} (or (nil? value) (map? value))

a.espolov13:12:28

1.0.0-alpga22 it’s ok

hmadelaine13:12:31

Hi everyone ! Anyone has an example with Datomic on the back end and Datascript on the client ? I am struggling a little with the merge functions...

denik13:12:33

can someone elaborate on the :value key of this? I find it confusing. It describes constrains on correctness while saying it will have no-effect at all?

:mutate - a function of three arguments [env key params] that should return a valid parse mutation result map. This map should contain a :value and an :action entry. :value is an optional hint at keys affected by the mutation; it has no effect on rerendering and should only contain keys valid for :read functions. The value of :action should be a function of zero arguments that applies the requested mutation.

denik13:12:01

Is :value … documentation?

denik13:12:22

can :value … be omitted?

dnolen13:12:58

@denik you can omit but it’s generally not a good idea - you want to document the implications of the mutation

denik13:12:20

@dnolen: so it’s contents will not be used by the code?

dnolen13:12:48

@denik: it depends on your code

dnolen13:12:00

in the remote case you will likely want to use :result

dnolen13:12:09

in the client/server case you will probably use :tempids

denik13:12:32

@dnolen: okay so no direct effect on client. Thank you!

dnolen13:12:47

@denik: that’s not what I said

denik13:12:15

@dnolen: hmm I still have trouble understanding what :result and :tempids have todo with it

dnolen13:12:49

anyways you can make no assumptions about how :value will be used at this time

denik13:12:51

@dnolen: my issue it that I have some components that don’t rerender after a transaction and I want to understand if :value has something todo with it

dnolen13:12:07

@denik has nothing to do with it

denik13:12:25

okay that helps a lot

dnolen13:12:32

if your components didn’t re-render then you didn’t request those keys to be re-read

dnolen13:12:22

@denik ah it just sound like you’re not aware of the structure of :value in the mutations case

denik13:12:36

well what if to components have the same query? Then, in the parent component, I only get the query from one component and pass the same props to the other which is query-less

dnolen13:12:44

:value is {:keys […] :tempids {…} :result …}

dnolen13:12:26

:tempids and :keys can be elided

dnolen13:12:34

:tempids will be used if present

denik13:12:42

but not result?

dnolen13:12:57

:result is the result of the mutation

denik13:12:05

and required to rerender?

dnolen13:12:09

what you do with it is up to you

dnolen13:12:28

the only thing that causes a re-render is requesting a re-read in the transaction

dnolen13:12:31

nothing else

denik13:12:37

I think I understand. It’s about providing the data of the mutation for sync

dnolen13:12:01

[(do/it!) :foo]

dnolen13:12:10

^ :foo causes a re-render, nothing else

denik13:12:35

wow, okay that is it @dnolen

denik13:12:55

will add to the docs

dnolen13:12:49

@denik that last sentence is very wrong

dnolen13:12:02

@denik: please correct by looking at the actual docstring for transact!

dnolen14:12:39

@denik let me tweak it

denik14:12:53

@dnolen: please do. Thank you simple_smile

dnolen14:12:07

there’s really no need to talk about the :read aspect of parse at all

marcol16:12:40

Is it possible to give props as input to the component when doing add-root! ?

iwillig16:12:07

When doing a remote update and i return the tempids mapping from the backend, is there anything i need to do make sure om.next updates the local client database with the new real ids. This is re-rendering but with the temp id.

(add-invite! [e]
    (.preventDefault e)
    (let [value (some-> e .-target .-form .-elements (aget 0) .-value)] ;; this is a mess
    (om/transact! this `[(admin-ui/add-invite! {:org-id ~id :email ~value}) [:organization/by-id ~id]])))
And this is my mutate function
(defmethod mutate 'admin-ui/add-invite!
  [{:keys [state ast]} _ {:keys [:email :org-id]}]
  (let [temp-id (om/tempid)
        ast (update-in ast [:params] #(assoc % :temp-id temp-id))]
    {:action (fn []
               (swap! state update-in [:invite/by-id] assoc temp-id {:db/id temp-id :invite/email email :organization/_invites {:db/id org-id}})
               (swap! state update-in [:organization/by-id org-id :organization/invites] #(vec (conj % [:invite/by-id temp-id]))))
     :remote ast}))
This is my response from my server,
["^ ","~$admin-ui/add-invite!",["^ ","~:keys",["~:invite/by-id",17592187944777],"~:tempids",["~#cmap",[["^2",["~#om/id","~u39e94a90-8982-4d87-929f-88c508c28f20"]],["^2",17592187944777]]]]]

arohner16:12:34

@dnolen: Slack lost your instructions about what the foam design doc needed, so I did this from memory: https://github.com/arohner/foam/wiki/Design . It definitely needs more work. What else would you like to see added?

dnolen16:12:05

@arohner: cool will have to give a thorough read later but feel free to copy that stuff here https://github.com/omcljs/om/wiki/Server-Side-Rendering

marcol16:12:56

Is it possible to give props as input to the component when doing add-root! ?

dnolen16:12:01

@marcol not really - that could be made to work but I don’t really see a compelling use case

dnolen16:12:18

@marcol do you have something in mind that’s not obvious?

a.espolov16:12:09

guys how to advanced build mode

dnolen16:12:02

@a.espolov: you can probably ask that question in #C03S1L9DN - but

marcol16:12:46

@dnolen more from a design perspective, I have data being taken from the query string but I did not want my component nor my parsing read function to have to get this information directly from the request, therefore wanted to decouple this responsibility and have this information be given.

dnolen16:12:26

@marcol you talking about a bunch of things that Om is not really concerned about

dnolen16:12:57

@marcol what’s the actual problem?

dnolen16:12:17

if you’re just talking about convenience than, no not interested

marcol16:12:48

@dnolen not a problem per se, just more of an architecture/design that I'm trying to achieve, so from that perspective you can say it is convenience simple_smile

dnolen16:12:56

@marcol nobody else has asked for this neither in Om previous or next

dnolen16:12:26

and it doesn’t really make any sense to me since the root component implicitly takes the root value of the query applied to the applicate state

dnolen16:12:40

so at the moment - I don’t see what purpose it could serve for most users

joshfrench16:12:30

@iwillig you’ll also need to give the reconciler a clue as to what to migrate: (om/reconciler {:state … :parser … :id-key :om/id}) (or whatever your primary key is)

marcol16:12:40

@dnolen I have a single page app, and the application state has projects. A request is then made by the user to see only 1 project, which changes the hash of the url. A hash change is detected and the view is changed to show project information. I'm doing this by doing an add-root! with a new component; therefore, was looking to have the project id be passed as an input instead of having the component or the query need to look at the query string for the project id

dnolen16:12:54

@marcol: it sounds like the actual problem is - routing

dnolen16:12:12

@marcol other people are working on that with various ideas and I have some things in the pipeline as well

iwillig16:12:13

@joshfrench: should it om/id or the key that my id are store in? in cause it would be :db/id

dnolen16:12:28

@marcol in anycase, no we’re not going to support what you are asking

marcol16:12:42

ok, thanks for the clear answer simple_smile

marcol16:12:52

i will look into routing simple_smile

dnolen16:12:54

you’ll have to look at what other people are doing and tune in when I talk about routing sometime in January

marcol16:12:14

sounds good, will keep an eye out for that

marcol16:12:22

thanks again

tony.kay17:12:22

@dnolen: Thanks for the fast fix to query->ast

dnolen18:12:19

@tony.kay: np was an easy fix

firinne19:12:26

@kahunamoore: much appreciated

tony.kay20:12:46

@dnolen: Calling merge! on the reconciler seems to lose the :om.next/tables. Is that set a legacy thing that isn't cared about, or is it supposed to be present?

dnolen20:12:23

@tony.kay: that has been evicted from my mental cache - can’t remember

dnolen20:12:34

deep in ClojureScript fixes so not going to load that up at the moment