This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-05-20
Channels
- # beginners (49)
- # boot (139)
- # cider (10)
- # clojure (82)
- # clojure-belgium (59)
- # clojure-dusseldorf (5)
- # clojure-russia (11)
- # clojure-sanfrancisco (2)
- # clojure-uk (56)
- # clojurebridge (4)
- # clojurescript (138)
- # cursive (19)
- # datomic (8)
- # dirac (1)
- # editors (11)
- # emacs (18)
- # flambo (21)
- # hoplon (45)
- # jobs (1)
- # juxt (3)
- # keechma (1)
- # mount (43)
- # off-topic (2)
- # om (64)
- # om-next (1)
- # onyx (2)
- # other-languages (8)
- # re-frame (72)
- # reagent (99)
- # ring-swagger (7)
- # rum (3)
- # spacemacs (21)
- # specter (5)
- # untangled (42)
- # vim (4)
- # yada (7)
Some combination of the latest google chrome, om.next, and/or figwheel do not seem to be working together. When I work through the first part of the Om.Next tutorial and try to load up localhost:3449
, I get the exceed max line 4096
error. Is anyone else experiencing this?
@jbranchaud: I just went through the tutorial yesterday without a hitch. I am using Chrome Mac Version 50.0.2661.86
. I used the om.next/figwheel/etc defined in the project.clj
file
I did wrap the lein
call in rlwrap
And just to be a little bit more verbose 😉 lein —version
gives me: Leiningen 2.5.3 on Java 1.8.0_91 Java HotSpot(TM) 64-Bit Server VM
hmm, so I just got it to work with an incognito window. Any ideas what could be going on in a regular chrome window that would cause this?
I don’t sorry, I am just starting out myself 😉
Thanks for replying. I have something to work with now!
Something to do with large cookies, perhaps? https://github.com/http-kit/http-kit/issues/196
@danburton brilliant. I went in and deleted some localhost cookies that should have been cleared out long ago and everything works as expected now. Thanks!
Looks like a bug with http-kit, which is used by figwheel-sidecar, which presumably you are using for the om.next demo.
@anmonteiro: I've created the smallest repro I could do of what seems like a build-index*
bug, where eventually a call on nil
is happens in clojure.zip/node
.
Setup involves queries which depend on props, where nested components call om/set-query!
.
Link: https://github.com/petterik/om/tree/zip-node-nil-error
( link to the commit: https://github.com/petterik/om/commit/d6858c1361dd60d87b9c1369672cfd5ede792827 )
(let [component (get-in (om/props this) route-path)] (conj query {:route/data (om/get-query component)}))
Yeah, it's confusing. I added an assert and it doesn't return nil. It's returning a component's route (which is a component). Check the state for the commit
I added an assert to be certain that it's not nil. The devcard is runnable, if you're interested in checking it out
@petterik: looking into it now
is it possible to dispatch on more than one key? e.g.
(defmethod read [:foo/bar :foo/baz]
[_ key _]
(if (= key :foo/bar) …etc..)))
Not sure if it's clear to you: note that your question is about multimethods, not om, and you can define read/mutate however you like
@tomjack: I’m gonna pretend that you’re talking about quantum physics and that whatever you said totally made sense to me and I would keep nodding and just say nothing 😄
What doesn't make sense? I would not recommend a custom hierarchy partly because it's not well known :)
Also you would have to write just one of the keys and the others would be magically dispatched there based on the hierarchy
I'm having an issue when I'm creating a remote entity on the server, but also adding novelty by adding attributes during the create (adding a sequence number). So I'm returning a stable id, but also adding novelty to the new entity. I think the problem is in the order of operations of merge!
So I'm merging:
{app/create-circuit {:tempids {[:db/id <#C06DT2YSY>/id["7c2ee779-f632-4359-9115-8e8aaac7d2dd"]] [:db/id 17592186045857]}}, [:db/id 17592186045857] {:circuit/id 12}}
But since merge! add novelty before resolving tempids, I have to include the tempid in the novelty
But then the reconciler can't update the component because its trying to look it up by tempid. So I end up having to send the novelty by both tempid and stable id
{app/create-circuit {:tempids {[:db/id <#C06DT2YSY>/id["7c2ee779-f632-4359-9115-8e8aaac7d2dd"]] [:db/id 17592186045857]}}, [:db/id <#C06DT2YSY>/id["7c2ee779-f632-4359-9115-8e8aaac7d2dd"]] {:circuit/id 12}, [:db/id 17592186045857] {:circuit/id 12}}
(def state (atom {:todo/by-id {1 {:todo/id 1 :todo/title "got milk?"}
2 {:todo/id 2 :todo/title "bar"}}
:todo-list/by-id {1 [[:todo/by-id 1]
[:todo/by-id 2]]}
:widget/root {:todo/list [:todo-list/by-id 1]}}))
(def state (atom {:todo/by-id {1 {:todo/id 1 :todo/title "got milk?"}
2 {:todo/id 2 :todo/title "bar"}
3 {:todo/id 3 :todo/title "bazz"}
}
:todo-list/by-id {1 [[:todo/by-id 1]
[:todo/by-id 2]]
2 [[:todo/by-id 3]]}
:widget/root {:todo/list [[:todo-list/by-id 1]
[:todo-list/by-id 2]
]}}))
gives me back the data {:todo/list
[[{:todo/title "got milk?", :todo/id 1}
{:todo/title "bar", :todo/id 2}]
[{:todo/title "bazz", :todo/id 3}]]}
which is still decent attempt at resolving the query expression, but I don't think htat piece of data corresponds to the query expression [{:widget/root [{:todo/list [:todo/title :todo/id]}]}]
if I don't specify :keys on a mutation, what are the consequences? does :keys just take root keys only?, or a query expression? or? what happens if I mutate an ident, do I need to return the keys of the ident that changed, as well as any keys that may have subtrees that reference this ident?
@jasonjckn: can you give an example?
sure,
(def state (atom {:todo/by-id {1 {:todo/id 1 :todo/title "got milk?"}
2 {:todo/id 2 :todo/title "bar"}}
:todo-list/by-id {1 [[:todo/by-id 1]
[:todo/by-id 2]]}
:widget/root {:todo/list [:todo-list/by-id 1]}}))
(defmethod mutate 'todo/add!
[{:keys [state target]} key {:keys [title]}]
{:action
(fn []
(swap! state
(fn [{:keys [todo/by-id todo/list] :as st}]
(let [id (next-id by-id)]
(-> st
(update :todo/by-id assoc id {:todo/id id :todo/title title})
(update-in [:todo-list/by-id 1] conj [:todo/by-id id]))))))})
` what do I return for {:keys ...} in the mutationat the end of the day I have no mental model for {:keys } what does om.next do withit?
i don't even know if it takes query expressions, or just a vector of root keys that have changed, or
in this example
:widget/root
has 'changed' due to ident following, so are the keys for this mutation [:widget/root :todo/by-id :todo-list/by-id]
@jasonjckn: oh, :keys here is just the 3rd argument destructuring to bind the value of the :title key to title
When you call (om/transact! this '[(todo/add {:title "blah"})])
om calls your parser with {:title "blah"}
as the third parameter which your mutate fn destructures with that syntax.
I really want to know the answer now, but my google-fu has not come up with anything satisfactory...
i'm getting the error
next.cljs:1268 Uncaught #error {:message "No queries exist for component path (om-todomvc.core/RootView om-todomvc.core/MainView om-todomvc.core/TodoList om-todomvc.core/TodoItem) or data path [:widget/root :widget/main [:todo-list/by-id 1]]", :data {:type :om.next/no-queries}}
when I double click on one of the TODO items, the error makes no sense to me, i don't know what code is relevant, here's the whole source code https://www.refheap.com/4a23101ec4a22da858a1d23f4#L-73 if you look at L73, if I replace that with update-state with a blank #() then the error stops happening, not sure why update-state would produce an error message like that@danburton: thanks, do you know if :keys are needed before both local and remote mutations, or just remote?
@jasonjckn: I looked into your question a bit out of curiosity, but didn't see where the :keys were used. The parser code mentions being able to return {:value {:keys [...]}}
from a mutate fn, but it wasn't obvious where that was used in the reconciler.