This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # admin-announcements (19)
- # announcements (1)
- # beginners (70)
- # boot (192)
- # braid-chat (55)
- # cider (3)
- # cljs-dev (42)
- # cljsjs (2)
- # cljsrn (25)
- # clojars (23)
- # clojure (162)
- # clojure-brasil (3)
- # clojure-czech (18)
- # clojure-russia (10)
- # clojurecup (3)
- # clojurescript (63)
- # code-reviews (6)
- # community-development (340)
- # core-async (7)
- # cursive (4)
- # datomic (20)
- # events (2)
- # funcool (3)
- # hoplon (20)
- # jobs (33)
- # ldnclj (11)
- # lein-figwheel (9)
- # leiningen (6)
- # off-topic (1)
- # om (79)
- # proton (4)
- # re-frame (39)
- # ring-swagger (4)
- # slack-help (2)
- # yada (2)
@anmonteiro: BR ou PT?
has there been any attempts on server-side rendering for om next?
as far as i can tell there are 3 ways: prerender, nashorn & a foam-like hack (convert cljs back to clj)
wondering which one is the most feasible
to answer my own question: found this https://carouselapps.com/prerenderer/
@settinghead: looks promising
hi guys, can some one explain to me how mutation works in om next. I know how to run mutate, but I wonder that in
:value of mutation function, we will specify the content will be returned back. And my question is , the component itself will get that data and merge to current data ? and how do we handle the error return from backend ?
@anmonteiro: Thanks for writing the recursion article. I'm a bit confused by how ident is handled.
.. and declare its Ident, a unique key by which each data item is identified. In other examples I've seen the ident declared on the child components (each data item), as opposed to a parent. Is that necessary on account of the recursive query? or what is the motivation one way or the other?
:value of a
mutation contains a map with
:tempids (from the quick-start tutorial) It just says 'I want a reread for this or that key'. The Reconciler has a
:merge-tree key which default to the standard clojurescript
merge, that function merges your old and new data. After merging, your Root component gets its new props, which flows down React-style.
As to error handling, it depends on what you want to accomplish...
An example of another style of merging new and old data is the following:
(defn custom-merge-tree [a b] (if (map? a) (merge-with into a b) b))
It'll merge keys without overwriting,
thanks @iwankaramazow. I'm trying to wrap my head around reconciler and om next engine.
@locks: PT living and studying in Germany
@rburns: the ident in union queries is located where the union entry query is. It's valid for all union queries, not only recursive as in the post
@anmonteiro: is the alternative not valid for union queries?
@rburns: if you look at the composite design pattern, Leaf and Composite inherit from the Component Class. In the recursive example you could look at it as Component is a child of the Root-Component. Leaf and Composite aren't childs from Component, they are a particular kind of Component. (no idea if this makes sense)
In other examples I've seen the ident declared on the child components
the base class is the child component here
hmm, maybe on the other hand you could move the
Composite , but it seems to be 'better' design to give that responsibility to the base class
ah wait you can't
looking at the render function https://gist.github.com/anmonteiro/2b282aa35380558a8b1d#file-composite-cljs-L83-L87 clears some things up. I guess I'm just curious how the choice affects om's mechanics, if at all.
I just tried moving the
Composite , seems it isn't really possible
@iwankaramazow: you mentioned redux + falcor being a mess, I wouldn't call our codebase (which uses them) a mess but it ain't elegant either. Did you have a look at the recent update to redux-falcor? The author seems to have switched to a "component declares paths" style, a little closer to om.next in some sense.
@bbss the project was finished around 15 december 2015, just before the latest redux-falcor update. So I can't comment on the current situation. Basically keeping the redux state and falcor model in sync gave me a lot of problems. Get & Set operations were fine, call was problematic. The normalization & reshaping logic from backend to falcor router was very error prone too. It worked, but it took a lot of time.
I extended redux-falcor with a lot of things to make it work.
Honestly I can't believe Netflix uses the thing they open-sourced in production.
Is both Om and Om Next on topic here?
In the Om Next quick start, it says "When writing a backend parser you will usually supply env yourself.” By backend, is it talking about Clojure running on the server (not ClojureScript running on the client)?
What is not necessary, passing env or the server side?
Ah, yeah. I am using Clojure on the server side.
@dnolen: Is there a reason why om.next provides transit readers and writers as custom functions instead of maps of read and writer handlers which could be merged with other read and write handler maps?
Current ring-middleware-format options only allows providing read and write handlers as maps
Ah, and sorry about not reading the topic first
@juhoteperi: it could be done that way, but it’s really not that important
no idea why ring-middleware-format imposes such a design and I don’t really care about that
Well, I care because I'm looking into fixing the problem if there is one, but I'm first trying to understand if there's a reason why read and write handlers are not maps
@juhoteperi: Would this approach work for you? https://github.com/Jannis/copaste/blob/master/src/server/handler.clj#L44
@juhoteperi: it just doesn’t matter
@jannis: Not currently as r-m-f doesn't provide decoder and encoder options, but that's probably going to change
@juhoteperi: I'm not sure I understand. The code above uses r-m-f with
@jannis: Oh right, but restful middlewares don't allow those options
@juhoteperi: Right, you mean
@jannis: Yes. If you are interested the issue is being discussed here: https://github.com/ngrunwald/ring-middleware-format/pull/54
Do Om Next apps tend to have only one reconciler?
@pupeno: there’s not good support for having more than one outside of devcards or something like that
Ok. I’m just confirming my assumptions to see if I understand things correctly.
I'm working on recursive queries with Datascript and I have a question about
om/process-roots. It would seem unnecessary when using an external state store, but I want to make sure there isn't some magic under the hood controlling component re-rendering based on keys.
that is identify which parts of the query actually have some interpretation on the server
Thanks. So I'm sure some datascript users might need it but I'm backing with datomic and just returning datoms from the server, so the om query is just client-side scaffolding.
can anyone point me at documentation or an example about how to handle associated data models. As an example, I could have a list of users at some place/component and at another place/component I want to show messages of those users, combining data from
user in the same place.
@juhoteperi FYI what I did about the transit handlers for now is replicating the handlers from https://github.com/omcljs/om/blob/master/src/main/om/transit.cljc in my own code and passing those via
:handlers options down to the reader/writer.
@nblumoe: I think these two pieces of @tony.kay's tutorial are useful for that https://awkay.github.io/om-tutorial/#!/om_tutorial.C_App_Database_Exercises https://awkay.github.io/om-tutorial/#!/om_tutorial.E_State_Reads_and_Parsing
inside here the author uses (get-in app [:main-app :background-color]) but then later on he uses (get-in app [:zoom-factor])
:zoom-factor is a top level key as well https://github.com/jackschaedler/goya/blob/master/src/cljs/goya/appstate.cljs#L43
@anmonteiro deployed Devcards 0.2.1-4 with your Om Next Helpers https://github.com/bhauman/devcards/blob/master/example_src/devdemos/om_next.cljs
@anmonteiro only gotcha was the file named
devdemos/om-next.cljs. Those dang hyphens. We need an automated check for that crap. 😀
@bhauman: cool stuff, thanks! Working on improving the reload story, might have something for you to look at later
for people hacking on Om Next - it’s now possible to run the tests from the command line via