This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-10
Channels
- # arachne (2)
- # beginners (5)
- # boot (6)
- # cider (3)
- # cljsrn (2)
- # clojure (34)
- # clojure-brasil (1)
- # clojure-poland (1)
- # clojure-spec (52)
- # clojure-sweden (1)
- # clojurescript (17)
- # datomic (14)
- # leiningen (3)
- # luminus (2)
- # om (85)
- # proton (89)
- # protorepl (1)
- # re-frame (1)
- # reagent (8)
- # ring-swagger (1)
- # spacemacs (2)
- # yada (6)
I'm trying to extend the tutorial on normalization and identity. I want to set the query for RootView to something else but I'm getting an error.
Warning: flattenChildren(...): Encountered two children with the same key, `.$null`. Child keys must be unique; when two children share a key, only the first child will be used.
I think I understand the error. After I set the query, the props come back as
{:list/two [nil nil nil]}
I'm not sure why that is.@creese: Your first error comes from React. A good way to stop it is to have a :keyfn in your component factory function.
With the second I would expect let [{:keys [list/one]} (om/props this)]
to work. You only have one join keyword (`:list/one`), so that is all that should be coming out of props.
I don't think set-query
is used for setting the whole query, just for setting params, so should be used in conjunction with IQueryParams
.
The tutorial renders two lists sequentially. I want to create a nav so I can choose which one is displayed.
I'm working off this one: https://github.com/omcljs/om/wiki/Components,-Identity-&-Normalization
I want to figure out routing. I have two pages now, each one shows a different list. I haven't seen a tutorial on that.
This looks promising: https://github.com/Jannis/om-next-kanban-demo/blob/master/src/kanban/app.cljs
@cjmurphy: I'm working through "Routing with Union Queries". The query is:
[:app/route {:route/data {:app/home [:home/title :home/content], :app/about [:about/title :about/content]}}]
What should the data be?"Don't know how to create ISeq from: clojure.lang.Symbol” and it’s pointing at the reify part of every single one of my component
---- Could not Analyze src/cljs/om_test/core.cljs line:27 column:3 ---- Don't know how to create ISeq from: clojure.lang.Symbol 26 (defn cell [cell owner] 27 (reify ^--- Don't know how to create ISeq from: clojure.lang.Symbol 28 om/IRenderState 29 (render-state [_ {:keys grid-values}] 30 (dom/div #js {:className (str "grid-cell tile-position-" (:id cell)
I'm working through the routing examples in https://github.com/anmonteiro/anmonteiro.github.io/tree/master/assets/cljs/om_next_routing
The example for Routing with Union Queries works fine, but I'm getting an error when I try the version using set-query!
Uncaught Error: No method in multimethod 'om-tutorial.core/read' for dispatch value: :params
It seems that when set-query! is called in componentWillMount, the query is wrapped in :params and this is seen by my read parser that way.I've created a repo for anyone who wants to take a look: https://github.com/creese/om-next-routing-example
@creese: Seems like you got through the Unions example. The example that really helped me with Unions is here: https://github.com/untangled-web/untangled-cookbook/blob/master/recipes/tabbed-interface/README.md. I can't help with set-query!
as so far for me there have always been simpler approaches - like just using Om Next app state - that have solved the problem.
@wilkerlucio: so the problem is the distinction between class / instance
when you write (js/Object.create (.-prototype c))
, get-query
will think this is a component instance instead of a component class
so you’ll also need to: (gobj/set c "om$isComponent" false)
then everything should work!
@anmonteiro: I confirmed your fix to that migrate issue dropping ::compassus/route. Thanks again!
@cmcfarlen: cool, I’ll probably cut a release later today
@cjmurphy: The main requirement is that the query be small. The props should contain only data for the component shown.
@creese: The actual data that you give to a component is not exactly related to the component's query: you can have a component with lots of keys yet only provide data for some of them - the others will just be nil. Also with all the join keys it is not known whether 0, 1 or more of the joined to component are actually going to be arriving.
@anmonteiro: humm, I just tried that, at first doing that on the non advanced
made it work, but in advanced it still failing... let me show you my last attempt (I though that would work, but it didn't):
failed with same error as before, it still considering it a component when checking at om/component?
I had set the prototype property besides the one in object.create because otherwise on the second run it doesn't find the .prototype
@wilkerlucio: so you might be confusing something there
this
will be bound to a class before instantiation but it will be bound to an instance after initialization
and an instance doesn’t have a prototype
so then you can call the method directly
I'm confused, because the idea was to just be passing a static class around to call protocol methods on it, it wasn't supposed to be an instance of the class anywhere
the Object.create
I though was a hack so we can be able to call those methods again (because on advanced compilation, everytime I return the class from a method it loses the static methods)
@wilkerlucio: right but after a component is mounted you’re probably passing a component instance?
this method of mine is never called on instances, just statically
and you can check my last snippet, it's a minimin case isolated from my code
hrm, I’ll double check it later and let you know
the issue here is being:
1. I have a custom static protocol on my Om component
2. The class of the component is returned by a function
3. We call this static method on this returned reference
4. Inside of the static method, we call another static method (`get-query` on this case)
this last call is being the one that is failing for me no matter what I do
and thanks for looking at it with me
if you specify!
on it outside of defui
does it work? e.g. (defui Foo)
, (specify! Foo ICustomProtocol)
?
@wilkerlucio: so I’m noticing something now
if you already modify the object in which you’re making the 1st call
why are you doing it a 2nd time?
my thinking is that is should just work because you’re receiving the right object then
the second was more like a desperate attempt, because without didn't worked as well
what I'm noticing is that once we convert it to an instance, we can't get back to a "static class"
the call to get-query
is thinking we are dealing with an instance, but that is not the intention
setting the om$isComponent
is not taking effect for some reason
@wilkerlucio: that just sounds weird to me, but I haven’t looked at your minimal case yet
can’t do it until a little bit later, so take my words with a grain of salt
that's really weird, I'm guessing it's about some transformation happening during the adv comp, but I didn't figure what is exactly
can you tell me more information about the original issue, like, why on adv compilation it loses the static methods in the first place?
@wilkerlucio: no idea, no, I’ve only seen it by reading Om’s source
just pushed devcards-om-next
version 0.2.0 to clojars with fixes to defcard-om-next
which actually reloads component code while preserving local state
https://github.com/anmonteiro/devcards-om-next
you can read more about it here: https://anmonteiro.com/2016/02/om-next-meets-devcards-the-full-reloadable-experience/
@anmonteiro: I created this gist to make easier once you want to try to reproduce, so you can check if you see the same results as I do: https://gist.github.com/wilkerlucio/8d0e129eb714a530ecf56cddb7841169