This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # aatree (1)
- # alda (9)
- # beginners (63)
- # boot (124)
- # braid-chat (8)
- # cider (44)
- # cljs-dev (44)
- # clojure (79)
- # clojure-dev (1)
- # clojure-russia (47)
- # clojurescript (105)
- # community-development (16)
- # cursive (3)
- # datavis (1)
- # datomic (54)
- # editors (10)
- # editors-rus (10)
- # emacs (18)
- # garden (1)
- # hoplon (5)
- # jobs (1)
- # ldnclj (6)
- # lein-figwheel (2)
- # luminus (1)
- # off-topic (29)
- # om (49)
- # overtone (5)
- # parinfer (12)
- # proton (2)
- # re-frame (5)
- # reagent (6)
- # ring-swagger (1)
- # slack-help (3)
- # spacemacs (1)
- # yada (42)
Is this a good example to try to wrap my head around Om Next: https://github.com/swannodette/om-next-demo ?
It may have been updated recently, otherwise does not work, so good to read only. What helped me the most was the Kanban demo. But there are now quite a few around...
The Kanban one shows a 'big application', so is a contrast to all the tutorials which concentrate on the mechanics.
That sounds like what I want. I’ll check it out. I’m particularly interested in server syncronization.
I meant PermGen error (I was reading about macros and not concentrating) :simple_smile:
I see. Is there an example that does client-server synchronization that I could play with?
steve8 or similar name did some good things. I'm not at that stage yet. I'll try to find...
Hello, I'm trying to build a login form with om.next. I would like the user to enter a username and password, which should be validated on the server. If the username and password is correct I would like to return an access token and merge this back into my app state. I'm not quite sure if I should use a parameterized query for that or a remote mutation fn. For the parameterized query I can see how the returned data is merged into the app state, but I'm not quite sure how to merge the result of a mutation fn into my app state, since what I get back from a mutation fn looks quite different than what I get from a query. Does anyone have an example app that does something similar, or any hints? Thanks.
For anyone interested, I also tested kioo (enlive style templating) and it works fine with Om-next.
the discussion yesterday about synthetic keys and that you only want them for top level … you also can’t link to them right? e.g. if
:user/todos is a top level key, you can make the parse method do whatever you want … but if its also linked from
:current-user, then you need to modify the
:current-user top level key as well to handle any queries with
I feel like I keep getting pulled in the direction of having a second interior parser and then only a few top level keys in the actual parser
db->tree but with the ability to 'plug in’ logic on certain keys
some examples in the tutorial call
parser recursively and put a ‘current’ object in it … but I feel like that is kind of mixing top-level and non-top level keys in the same thing
@r0man: I started off trying to do authentication as you mentioned, but found it better to do it outside of Om-next. I make a separate REST call to our IDM system, then store the token in a separate atom from my app state. Then my send function grabs the token and adds the auth header for every outgoing request. This was easier than ensuring every remote query included the token. Hopefully that makes sense. If you're still stuck, I can try to pull out the essentials into a gist, but it might be a day or two before I can get to that.
Oh yeah, I also set a flag in my app state as to whether or not the user is logged in (so the UI can adjust accordingly). You could set the token as well, I just didn't need the actual token for the UI itself.
@mdhaney: Thanks, that might also be an option. However I'm looking in general for an example that sends form fields to the server, the server validates the data, sends back an error message on a failure or does something when data is valid. And how to react on those 2 cases within om.next. I think I'm looking for an example of a general send function that handles errors as well.
I think I stuggle with how to merge the response of a mutation into app state, and do something depending on the result
@r0man: yeah, there are lots of ways to do it. The main point I wanted to make was that if the token is in your app state, you'll have to ensure that all your remote queries end up with the token, since most of the time you need to set a header with the token in your send function.
Our system is more complicated too, because our IDM system redirects to a particular url and passes the token as a request param, like Oauth. So for that you need routing in place as well. Not everyone will have all these requirements, but in corporate environments it's pretty common.
@mdhaney: yes, understood. My plan was to pass the state to my send function and fish the token out there on each request
How are you planning to pass the state? Send gets called with a map of remotes->queries and a callback. You'll probably have to make sure your app state is in an atom and either access it directly or close over it when you create your send function. And be sure to set :normalize to true on the reconciler, since by default normalization is turned off when you pass it an atom.
Actually, I think I have a commit on a branch where I did it almost exactly like you're saying. I'll see if I can track it down.
haven't thought about it too much, but yes I use a state atom, use :normalize true and access the state from my send function
Is there a description of the differences between Om Next, GraphQL/Relay, and JSONGraph/Falcor? I remember seeing or reading about it but I can't recall where.
but the short story is that Om Next is exactly Relay/GraphQL + Falcor + HTTP cacheability
@dnolen: Interesting, thanks. My (very limited) understanding was that GraphQL was typed. Is that accurate and would that be a difference from Om Next?
I’m probably going to write an ‘om.next from relay/graphql perspective’ thing as thats pretty much how I’m approaching stuff currently :stuck_out_tongue_winking_eye: