This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-17
Channels
- # admin-announcements (3)
- # beginners (15)
- # boot (5)
- # cider (25)
- # cljs-dev (9)
- # cljsjs (5)
- # clojure (30)
- # clojure-belgium (20)
- # clojure-boston (1)
- # clojure-greece (1)
- # clojure-japan (3)
- # clojure-russia (17)
- # clojure-uk (2)
- # clojurescript (49)
- # clojurewerkz (2)
- # cursive (5)
- # datomic (1)
- # emacs (1)
- # euroclojure (1)
- # hoplon (155)
- # jobs-discuss (17)
- # mount (6)
- # off-topic (1)
- # om (87)
- # proton (2)
- # re-frame (3)
- # remote-jobs (4)
- # spacemacs (2)
- # untangled (12)
@currentoor: there isn't an official way yet
@anmonteiro: after reading this post: http://anmonteiro.com/2016/01/exploration-patterns-om-next-part-1/, I try to launch the code of your gist: https://gist.github.com/anmonteiro/2b282aa35380558a8b1d#file-composite-cljs to understand how recursive queries are working but I receive an error "Uncaught Error: No item {:leaf [:id :width :height :color], :composite [:id :width :height :color {:children ...}]} in vector of length 2". can you help me? 😅
@raphael: pasting the code from the gist works for me
which Om version are you using
right, alpha22 doesn’t support recursive unions
alpha32 is the latest alpha
recursive unions are supported from alpha30 onwards
hmm, I might be missing something obvious but you have to manually post-process the result of a remote mutation on the client? (except for tempids)
A remote mutation returns something of the shape { 'mutation/key {:value {:keys … :tempids … :result ...}}
Should I manually process this stuff to (for example) merge the value of :result
under a key stored under :keys
?
nvm, figured it out 😄
Hi everybody, I made a TodoMVC using Om.Next, Datomic, Datascript and Server Sent Events for real-time sync U can find code here https://github.com/madvas/todomvc-omnext-datomic-datascript
@madvas: nice work
@iwankaramazow: thanks 😉
Hello all...I've been doing quite a bit recently with Om.next and was working on patterns for larger SPA development. Has anyone came to the conclusion that if you have a large data tree perhaps loading that all in via remote call isn't the most effective way to go? I don't see any other way at this point since it all comes in via Root (top) level query.
Essentially, you basically need to remote sync ALL the data they could ever get to in the application when it initializes. If you are only using, one RootView which from how I've seen people implement routing in SPA only use one top level root and flip in and out main components when routes change...
@tmorten: I hope you only fetch things that are on screen 😉
(unless you need to prefetch stuff)
@tmorten: Are you aware of http://anmonteiro.com/2016/02/routing-in-om-next-a-catalog-of-approaches/ ? If you use the set-query! approach then you would be able to create remote queries that only pull the data required for the current route.
I have read this...and I think this is interesting however, your top level keys have to align with your "routes"...
@tmorten: I'm implementing a router atm, there isn't a way around out.
Have given it a lot of thought, things need to compose with arbitrary joins...
I too have implemented a router solution, but mine essential swaps the "root" with a new root view. Problem is that it forces you to reload the entire view, i.e. navigation, menu, footer, etc...
Do you have nested routes?
you implemented a merge-with into
at merge-tree on the reconciler ?
i.e. `(merge' [a b] (merge-with into a b))`
Not sure I'm 100% following, what do you mean by reloading the entire view?
Your state resets?
ComponentDidMount fires every time on all components when you change a route?
I'm not 100% sure, but the add-root!
might be the problem..
The new root might replace the previous one
if it instantiates a new reconciler every time
that would explain the problem
or it might not 😛
I think it is the problem...however, I would essentially like my components to remote "query" their own data, but can't do that since it has to happen at the Root
My router (alpha version) is almost finished
Give me 4 days, and I'll open source it
cool, thanks @iwankaramazow
I've gone through and frankenstien'd some of this https://github.com/jdubie/om-next-router-example/blob/master/src/om_router/core.cljs
I started basically with the same
Can you explain ? I'm not 100% following
that's where my parser begins to read...but what if my actual top level element is :user/inventory
@tmorten: You can call the parser recursively, e.g. https://awkay.github.io/om-tutorial/#!/om_tutorial.E_State_Reads_and_Parsing
Seems like I still need to pull in all of the children from :user/inventory as I follow down the path
Ah you mean everything is merged under :route/data?
indeed as @symfrog says
call the parser recursively
Example:
(defmethod read :default
[{:keys [parser query state] :as env} key params]
(if (some #{key} [:app :home :test :union])
;; recursively call the parser,
;; i.e. we ignore :app || :home || :test || :union
;; and walk a little deeper in the query
{:value (parser env query)}
{:value (get @state key)}))
depends on the structure of the root query
I mean you probably have something like [{:some-page {:inventory [:stuff]} {:products [:other-stuff]}}}]
if you parse recursively at :some-page
it will dispatch on both :inventory
and :products
yea why not?
I think that is the source of my issue -- since on the inventories screen, I don't need to see the products, but I am loading every product from every inventory since I am pulling in EVERY product from EVERY inventory
query-params?
declare the things you want
it depends, it might come in handy the merge those results under the keys you want..
goto run
Does a call to set-query! update the indexer when keys are added or removed to a component's query expression? It seems that a component is only indexed under the static class query expression keys and that attempting to do a transact! with a re-render key only works if the key is present in the query's static class query. Is there any way to get a component to re-render if it's query has been modified via set-query! (e.g. adding/removing keys) and the key to be re-read is different or may not exist in the static class query?
@symfrog: set-query!
calls re-index
@anmonteiro: thanks, most likely an issue on my side then
Thanks for the help @iwankaramazow