Fork me on GitHub
#om
<
2016-02-03
>
jimmy03:02:45

@anmonteiro: I think there might something to do with the routing and query. The minimal case I can reproduce is using your template ( latest ), changing the landing.cljs content to. Try to click on the span in nav-ui you will see the error.

currentoor07:02:25

Hello, are people using Om.next in production yet?

cjmurphy08:02:39

Giving a nil logger to the reconciler will hide problems, such as warnings (and worse). This won't:

cjmurphy08:02:49

(deftype Logger []
  Object
  (info [this msg ex]
    ; It is pretty hard to get into what's returned so leaving for now
    ;(println "INFO" msg)
    )
  (warning [this msg ex] (println "WARN" msg)))
(def logger (Logger.))

anmonteiro08:02:52

@nxqd: right but your example is not valid

anmonteiro08:02:18

if you don't need a query, you don't need to implement IQuery

jimmy09:02:48

@anmonteiro: yeah it's true, but it's just an example of it. In the current app I am developing, I have IQuery in Page of course, but not in NavUi ( actually I don't implement the whole defui in current application, it's just nav-ui defn but both cause same error )

anmonteiro09:02:31

@nxqd: right but the example is not valid so I can't actually see if there's a bug there

jimmy09:02:26

I'm not sure what you meant that it's not valid. Regarding the query, you can put whatever you want there, it still causes the same error.

frankiesardo12:02:49

I’m trying to implement local storage caching with om.next

frankiesardo12:02:37

has anyone tried that already? My understanding is that it should be just another type of :remote, am I right?

frankiesardo12:02:35

Also, is not clear to me how server push “just falls out of the design of om.next”, as david pointed out here https://groups.google.com/forum/#!msg/clojurescript/o0W57ptvPc8/qs3y70zSDQAJ

frankiesardo12:02:20

Once I get the data from a push, how/where do I feed it into the om.next framework?

anmonteiro12:02:02

@frankie: 2. just call merge!

anmonteiro12:02:42

@frankie: 1. I'd say it's not another remote, but something your parser / send! function could handle

frankiesardo12:02:44

Re: 1, do you mean something like:

(defmethod p/readf :my/key
  [{:keys [state]} k _]
  (let [st @state
        storage (local-storage)]
    (cond 
      (contains? st k) {:value (get st k)}
      (contains? storage k) {:value (get storage k)}
      {:remote true})))

anmonteiro12:02:06

@frankie: for starters, sure

anmonteiro12:02:55

you'd probably need some logic in your send! function to store remote calls too

jimmy13:02:02

@anmonteiro: last time I did the debugging, when it first lands on the landing page there is no component path from class App to landing/Home. But when I switch another page, and come back right after that, it does have ( there is no more error ) .

anmonteiro13:02:01

@dnolen: atm reindex! in the reconciler passes the root class to the indexer's index-root

anmonteiro13:02:26

shouldn't we pass the instance so that the index is built with the updated queries (which might have changed in the process)?

dnolen13:02:18

@anmonteiro: yes - that would be a bug - would nice to have a test for reindex! functionality to verify it is working correctly

anmonteiro13:02:56

@dnolen: this is what's causing @nxqd 's issue. I can work on this

anmonteiro13:02:15

I'll try to incorporate a test in the patch

anmonteiro13:02:38

I think this would also be related to what @peeja was reporting the other day?

dnolen13:02:53

yes likely for anyone trying to transition queries

jimmy13:02:12

awesome, thanks guys

thomasdeutsch15:02:19

If i have a root-component with a query [:a :b] and a sub-component with a query [:a] , should i merge/conj those queries? or should i try to pass the data down to the sub-component as a computed value?

thomasdeutsch15:02:28

and have no query in my sub component.

bplatz16:02:09

I've got a recursion problem that I can't shake. Perhaps I'm doing something wrong... I have a base case with this simple query:

bplatz16:02:17

[{:user [:user/name {:user/friends '...}]}]

bplatz16:02:56

That always throws: Uncaught RangeError: Maximum call stack size exceeded

bplatz16:02:00

In the browser. I've tried different clojurescript versions, different om versions, still always get the same issue.

bplatz16:02:19

Anyone have recursion working that can let me know if they ever had similar error(s)?

anmonteiro16:02:40

@bplatz: are you on latest master?

anmonteiro16:02:07

and is not included in any alpha yet

bplatz16:02:46

Ahh. I'm on alpha 30

bahulneel16:02:15

@dnolen: are you able to share the source code for the om-tutorial code that you use to demonstrate om.next and generative testing?

rauh16:02:17

Is there an easy way to do Mixins in om.next? factory doesn't seem to support it. Edit: Nvm, solved it with composition using ui.

taylor.sando17:02:24

Has anyone gotten a boot project to work with om using checkout dependencies?

martinklepsch18:02:43

@taylor.sando: are you having a specific problem?

taylor.sando18:02:30

Can I just have a process that watches the om directory, such as fsmonitor and builds using lein install? Then have a checkout dependency in the boot project?

martinklepsch18:02:01

you can do that too yes. starting up lein everytime may take some time though

martinklepsch18:02:19

maybe there's also a lein install --watch kind of thing but I don't know of any

taylor.sando18:02:38

I would assume I'd need an actual boot build file, if I wanted to use something like boot watch pom -p foo/bar -v 1.2.3-SNAPSHOT jar install

taylor.sando18:02:12

At the moment I'm doing this: boot checkout -d org.omcljs/om:"1.0.0-alpha31-SNAPSHOT" dev -r to run my project, and I'm using fsmonitor -d src lein install in the om directory. Is this even right?

martinklepsch18:02:37

boot -d cljsjs/react:0.14.3-0 -d cljsjs/react-dom:0.14.3-1 [more ...] -r src/main watch pom -p org.omcljs/om -v 1.0.0-alpha31-SNAPSHOT jar install

martinklepsch18:02:09

@taylor.sando: that should work as well I guess

taylor.sando18:02:35

I'm not getting proper reloads in the project when source files change.

martinklepsch18:02:37

the checkout task just looks into your local ~/.m2 and refreshes files from there if they change

martinklepsch18:02:15

@taylor.sando: ah, perhaps your watch task is after checkout — that would mean the checkout task is only ran once

taylor.sando18:02:30

Ya dev has a watch task

martinklepsch18:02:31

probably safe to take this to #C053K90BR btw simple_smile

hueyp18:02:26

if working with react lifecycle … is there an equivalent om/props but takes the react lifecycle argument vs component

hueyp18:02:51

nvm om.next/-next-props simple_smile

hueyp18:02:55

oh double nvm, if I understand the macro its already done for me

hueyp19:02:39

in shouldComponentUpdate, there is this:

(not= (om.next/props this#)
                 (goog.object/get next-props# "omcljs$value”))

hueyp19:02:58

it looks like its comparing ‘wrapped’ vs ‘unwrapped’?

hueyp19:02:09

or am I misunderstanding?

anmonteiro19:02:22

@hueyp: misunderstanding, follow the code path of the props function

hueyp19:02:32

gotcha, in my componentWillReceiveProps, the props are equal, but they aren’t here, so digging in simple_smile

hueyp19:02:18

er, the props / next-props

firstclassfunc19:02:22

I am still getting hung up understanding integrating remote data into app-state. Has someone build a simple example?

anmonteiro19:02:03

@hueyp: componentWillReceiveProps can't quite be made to work as you might expect

anmonteiro19:02:30

I'd say use componentWillUpdate instead

hueyp19:02:45

when I try and just implement shouldComponentUpdate inline, I am getting an unwrapped props vs a wrapped props

anmonteiro19:02:22

right, so call Om's should-update?

anmonteiro19:02:26

or maybe I'm misunderstanding what you want to do?

hueyp19:02:33

I have some stuff re-rendering, and just want to figure out why. so I am implementing the om default shouldComponentUpdate in my component because I don’t know a better way to inspect the logic simple_smile

hueyp19:02:41

its entirely possible there is context outside of the function I don’t get .. but I just took this and put it in my component: https://github.com/omcljs/om/blob/master/src/main/om/next.clj#L123-L129

anmonteiro19:02:15

@hueyp: that's just not going to work

hueyp19:02:56

any suggestion on a way to see what might be causing a render?

hueyp19:02:08

e.g. ‘these two things are not equal, here they are!'

hueyp19:02:22

it can be hacky

hueyp19:02:01

I have an idea, but my limited attempt at ‘componentWillReceiveProps’ did not point to it, but you mention that is not the proper place to look simple_smile

anmonteiro19:02:03

@hueyp: not from the top of my head, is it following a mutation?

hueyp19:02:32

in componentDidUpdate … should prev-props be inspectable?

hueyp19:02:39

e.g. just do that instead of willreceive?

anmonteiro19:02:50

or willupdate, as I suggested before

anmonteiro19:02:57

components will be scheduled to render following a mutation, anyway.

anmonteiro19:02:19

i.e. the component which triggered the mutation will be queued

anmonteiro19:02:42

and any other keys that you specified to be re-read

anmonteiro19:02:53

these might trigger the rendering of other components

hueyp19:02:21

and the component which did the transact, it will call render even if its a no-op regarding state?

hueyp19:02:32

or it still does the normal lifecycle check?

hueyp19:02:57

I can check this out, don’t mean to quiz you 😜

hueyp19:02:13

time to try componentWillUpdate, thanks!

anmonteiro19:02:36

it is supposed to go through the lifecycle

hueyp19:02:21

yah, I do think something is mutated in the props, I just got confused by componentWillReceiveProps which you mention can be out of sync, I bet it was just that

hueyp19:02:50

there must be something deeper causing the update …

(componentWillUpdate [this next-props next-state]
    (let [props (om/props this)
          state (om/get-state this)]
      (println "will update : state & props"
               (and (= props next-props)
                    (= state next-state)))))

hueyp19:02:06

they are equal here so nothing I can inspect

anmonteiro19:02:11

@hueyp: (om/get-state) will be the same as next-state

anmonteiro19:02:25

you might want to be calling (om/get-rendered-state this)

hueyp19:02:36

ended up its nil in either case 😜

hueyp19:02:55

but yah, that was wrong

hueyp19:02:15

I guess I need to look deeper into om to see whats up

hueyp19:02:31

like the ‘superficial’ stuff is equal, which exhausts my react knowledge

hueyp19:02:53

thanks again for your help!

hueyp19:02:55

if I fork om to add some logging to shouldComponentUpdate … would that work? e.g. to print the results of the individual comparisons : https://github.com/omcljs/om/blob/master/src/main/om/next.clj#L123-L129

anmonteiro19:02:48

@hueyp: I just copied the code over from the next.clj file and it works

anmonteiro19:02:50

(shouldComponentUpdate [this next-props next-state]
    (println "from shouldUpdate" (om.next/props this) (goog.object/get next-props "omcljs$value"))
    (or (not= (om.next/props this)
        (goog.object/get next-props "omcljs$value"))
       (and (.. this -state)
            (not= (goog.object/get (. this -state) "omcljs$state")
                    (goog.object/get next-state "omcljs$state")))))

anmonteiro19:02:01

just use it in your component

hueyp20:02:18

from shouldUpdate {:id 2, :title “Entry 2"} #object[om.next.OmProps]

hueyp20:02:27

so … at this point I should check my om version simple_smile

hueyp20:02:46

I might be copying a more recent shouldComponentUpdate impl

anmonteiro20:02:08

@hueyp: I'm running the latest master

easystreet20:02:18

fwiw, unless something has changed since alpha30, this min case suggests to me that shouldComponentUpdate may be returning true in some cases where it shouldn't be: https://www.refheap.com/114181

anmonteiro20:02:30

@cascada-io: will look into that in a bit

hueyp20:02:31

@anmonteiro: when you run it locally — are either of your values in the logging output wrapped still? e.g. OmProps

Lambda/Sierra21:02:46

When using Om.Now with Datascript, how do the components know when to update?

Lambda/Sierra21:02:15

Does the entire UI get re-rendered in the virtual DOM every time the database changes?

dnolen21:02:54

@stuartsierra: it’s a part of the transaction, that keys you want to re-read

dnolen21:02:08

the indexer knows which keys map to which components and schedules them for re-rendering

dnolen21:02:57

DataScript is not really involved I should think

Lambda/Sierra21:02:29

@dnolen: Are you talking about the Om.now transaction or the Datascript transaction?

dnolen21:02:16

@stuartsierra: oops sorry you're talking about Om currently

dnolen21:02:36

I never tried DataScript with current Om, Kevin Lynagh did get some where with it

dnolen21:02:44

you might want to email him for some details about that

dnolen21:02:09

for his app he may have been OK with full re-rendering?

dnolen21:02:40

or he may have backed away from the Om provided stuff and used Om as React sugar

dnolen21:02:57

whatever he did we talked about it briefly and it seems his solution was as simple as he could possibly make it

anmonteiro21:02:50

@dnolen: just submitted a fix for what we discussed earlier today; tests provided, but they were a bit tricky since I had to call add-root! with a nil target, instantiate a component myself and call index-component! manually

anmonteiro21:02:05

but they're passing and the issue seems to be solved simple_smile

dnolen21:02:57

@anmonteiro: ok cool! thanks much

dnolen21:02:11

will take a look later

tony.kay21:02:43

Can someone tell me how to access an Om defui static field from within a lifecycle method...or just in general?

alasdair21:02:02

Do you mean a field like a field in defrecord? I didn't think that was supported. I think in om.next you would need to set/get props on an instance of a defui'd thing.

anmonteiro21:02:06

(defui Test
  static field foo 3)

anmonteiro21:02:12

then in render:

anmonteiro21:02:19

(.-foo (type this))

tony.kay21:02:28

ah, that was it...

tony.kay21:02:42

for the life of me I couldn't think of how to get to the class simple_smile

alasdair21:02:35

why does the doc say fields are not supported? are the docs just out of date? or is that something that works but isn't core to the libarary?

anmonteiro21:02:34

@alasdair: there's no support for fields like in deftype

anmonteiro21:02:53

i.e. (deftype Name [field1 field2])

alasdair21:02:25

@anmonteiro: as in instance/object fields? but static ok? Or is it just about differences in syntax?

alasdair22:02:41

I see thanks

alasdair22:02:18

@anmonteiro: I was asking about a page with multiple roots the other day. We guessed the way to do this was root + reconciler pairs pointing at a common atom (shared data) is that the "right" way to do it?

johnswanson23:02:06

i’m running into a “no queries exist for component path" error when attempting to run om.next/transact! during advanced compilation only

johnswanson23:02:44

i may be doing something silly here, but i’m not sure what it is simple_smile

taylor.sando23:02:25

Is that a quote or a backtick beside the test-mutate?

johnswanson23:02:16

well, hm. it was a backtick—changing to a quote doesn’t seem to affect the outcome, though