Fork me on GitHub
#om
<
2017-04-06
>
ag00:04:39

I have a function that does some data manipulations and returns {:value ,,, :remote ,,,}, it’s kind of “generic” it fits for most of the cases. I call it from my “read” methods, e.g:

(defn app-data-read [env k params] ,,,,,
  {:value ,,, :remote ast})

(defmethod read :foo
  [env k params]
  (app-data-read env k params))

ag01:04:24

now what if in another method I need to reuse the output of add-data-read and manipulate some more?

ag01:04:40

how do I do that? Maybe it’s just wrong to have the sort of “indirection” as app-data-read?

ag01:04:50

because something like this won’t work:

(defmethod read :bar
  [env k params]
  (let [v (app-data-read env k params)] 
    (assoc-in v [:value :data :bar-data] 42)))

ag01:04:29

oh, wait… no it actually works

raspasov03:04:58

@ag yea it should work, I don’t see a reason why it shouldn’t….

raspasov03:04:55

as long as it’s a pure function it shouldn’t matter how many function calls there are

ag03:04:56

Sorry, I got confused myself (again)

raspasov03:04:11

haha np 🙂 it happens to everyone

wilkerlucio15:04:00

hello, I'm having an issue with advanced compilation, this is the error: Rl {message: "Invalid join, {:app/search-form nil}", data: n, ag: null, name: "Error", description: undefined…}

wilkerlucio15:04:29

it seems like I can't get the query after advanced compilation, when I try (js/console.log "Root" (pr-str (om/get-query Root))), it returns nil for the query

wilkerlucio15:04:56

is there any known caveat about this on advanced compilation?

matthavener15:04:50

wilkerlucio: are you doing anything fancy with your cljs build process?

wilkerlucio15:04:49

@matthavener I don't think so, this is what my compilation setup looks like:

{:id           "production"
                        :source-paths ["src/client"]
                        :jar          true
                        :compiler     {:asset-path    "js/prod"
                                       :main          mortician-gui.main
                                       :optimizations :advanced
                                       :output-dir    "resources/public/js/prod"
                                       :output-to     "resources/public/js/mortician_gui.min.js"}}

matthavener15:04:04

ah ok, there’s a known bug that breaks get-query if you build after requiring om.next but that doesn’t look like its happening there

wilkerlucio15:04:57

what you mean building after requiring om.next?

matthavener15:04:20

I think the bug also asserts on get-query anyways, I don’t remember it returning nil

matthavener15:04:40

ah like if you run the cljs builder inside the JVM after doing other things. Instead of running it via lein-cljsbuild

wilkerlucio15:04:30

also, if I try to (om/query Root) it get's me Uncaught Error: No protocol method IQuery.query defined for type function: function (){React.Component.apply(this,arguments);this.state=null!= this}

devo16:04:14

Are there any examples of SSR with compassus besides the tests.cljc file in the compassus repo?

anmonteiro17:04:29

@devo I don’t think so, no

anmonteiro17:04:50

BTW, Compassus SSR doesn’t work with the very last Om Next release

anmonteiro17:04:12

so you need to use alpha47 for now

anmonteiro17:04:33

I’ve been meaning to look into that, but still haven’t had the time

devo17:04:30

No worries. Been having issues merging in state correctly when rendering a compassus app server side. Will just keep tinkering with it.