This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-13
Channels
- # beginners (14)
- # boot (108)
- # carry (6)
- # cider (28)
- # cljs-dev (107)
- # cljsrn (32)
- # clojars (4)
- # clojure (62)
- # clojure-austin (15)
- # clojure-berlin (1)
- # clojure-brasil (3)
- # clojure-chicago (1)
- # clojure-dev (9)
- # clojure-greece (2)
- # clojure-italy (4)
- # clojure-nl (1)
- # clojure-poland (2)
- # clojure-portugal (1)
- # clojure-russia (24)
- # clojure-spec (63)
- # clojure-uk (30)
- # clojurescript (123)
- # cursive (13)
- # data-science (1)
- # datascript (1)
- # datomic (27)
- # devcards (11)
- # dirac (1)
- # emacs (5)
- # events (4)
- # hoplon (27)
- # jobs (3)
- # juxt (3)
- # leiningen (11)
- # off-topic (18)
- # om (46)
- # om-next (7)
- # onyx (50)
- # pedestal (6)
- # portland-or (8)
- # proton (16)
- # re-frame (38)
- # reagent (21)
- # ring-swagger (14)
- # specter (46)
- # untangled (116)
- # vim (46)
- # yada (22)
oh I just realized how stupid my question is. you can’t see the result of parametrized query until it’s passed to parser, right?
In a clojurescript figwheel REPL what namespace has the "use" command -- I can't use swap! or even use and need to use the right namespace to get something workable
could someone possibly give a more detailed description of the relation between 'some-data' and 'app-state-db' in the db-tree docs? https://github.com/omcljs/om/wiki/Documentation-(om.next)#db-tree
@molstt sure. the app-state-db is the entire app-state where db->tree
will look when resolving idents & links
the “some-data” parameter is the subset of data that you want to denormalize
(it can be a single ident)
(om/db->tree [:foo/name :foo/other] [:foo/by-id 0] app-state
would probably return:
{:foo/name “Foo”, :foo/other “some other value"}
given that your app-state contained:
{:foo/by-id
{0 {:foo/name "Foo", :foo/other "some other value"}}}
I think I started grokking readers. It was really tough to comprehend what’s the flow of data like deeper into the query from root to children and bubbling back up. Will write a blog post hope it’ll help some others. The existing docs are good once you start getting it, but definitely for people who are very comfortable with cljs.
@anmonteiro some good stuff in your posts, @tony.kay also very helpful resources with om-tutorial. Definitely needs to go into “unofficial” docs section somewhere in wiki.
@molstt if you pass your root query and want to denormalize the whole state, sure
I never actually do that though
the most common thing is to call db->tree
like this: (om/db->tree query (get st k) st)
where k
is the key your parser dispatched on
mhm.. but (get st key) returns data from the database, while [:key 24] and :key are selectors.. isn't it two very different things?
@molstt (get st key)
could return a selector 🙂
normally it’ll return an ident or a list of idents, yes
@levitanong Thank you man for offering your help, I solved the problem with the text input that loses focus 😉
@anmonteiro I almost got it working now, the thing I don't understand now is why a query like this {:my-view '[{:stuff [:info [:root-mud _]]}]} returns proper data twice [{...proper data...} {...proper data...}]
@molstt that’s not enough information for me to understand what might be going on, sorry
@molstt happy to look at a particular example
something I can run at the REPL, for example
@rastandy glad you figured it out! 😄
Is it intentional that remotes only have effect when added besides :value at the reads for the top level components and not for leaf components? I have a recursive read function with a multimethod dispatching on leaf components supplying {:value "foo" :my-remote ast} for one of the components, but the send function does not get called. When moving :my-remote to the retval of a top level read function, the send function gets called as expected.
@molstt that’s how it’s supposed to work
if you call your parser recursively, the function call returns to your parser, not to the Om function which will schedule the send
function to be called
this might not be very straightforward to get at first, but it’s just like a recursive function call: the caller only sees the result at the top-level.
^ hope that makes sense. here’s an example of doing recursive parsing with remotes involved: https://github.com/awkay/om-tutorial/blob/master/src/main/om_tutorial/parsing.cljs#L191
yes, I was just looking for that function.. saw a ref to it in https://awkay.github.io/om-tutorial/#!/om_tutorial.G_Remote_Fetch
I wrote an article about how we added real-time collaboration to our Om Next app. https://medium.com/adstage-engineering/realtime-apps-with-om-next-and-datomic-470be2c8204b#.ur111tdjp
I'm new to react and om. Is it common to have the root redraw every time the state changes. The issue is that I'm using material design light and "upgrading" some of the styles on componentDidMount which makes the active tab flash inactive whenever my state changes. I'm using omnext defui if that changes anything.