This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-04
Channels
- # admin-announcements (15)
- # aws (1)
- # beginners (5)
- # boot (328)
- # cider (5)
- # cljsjs (7)
- # cljsrn (12)
- # clojure (100)
- # clojure-art (3)
- # clojure-austin (1)
- # clojure-chicago (1)
- # clojure-russia (19)
- # clojurecup (2)
- # clojured (2)
- # clojurescript (34)
- # cursive (10)
- # datavis (33)
- # datomic (9)
- # devcards (21)
- # editors-rus (1)
- # events (1)
- # hoplon (42)
- # jobs (5)
- # ldnclj (38)
- # mount (39)
- # om (140)
- # re-frame (26)
- # reagent (25)
- # spacemacs (1)
- # specter (3)
- # vim (1)
Hi. If I have an input
, some validation function (which receives value and provides either error message or nil
) a submit button
in Om Next app and I want (1) validate data as user types it (but not display the error message when the form is just untouched, "pristine"), and as a result make input's border red and display this error msg and (2) submit the data when the form is valid (i.e. transact!
it), should my "local" data for current value of input go to app's state (i.e. I should transact!
it too), or should I rather introduce some "local" state for such a small piece of functionality?
@smeister: you might find the “controller” idea in my ideas project relevant to your thoughts on keeping the view layer clean. I had the same observation so a controller is one way to address it
is there any kind of rough thinking on how Om-Next is progressing
aka when are thinking it would release - 2016 / 2017
Adding to @drusellers question: How different Om Next is from Relay + GraphQL? I.e. what it's providing what Realy + GraphQL doesn't (except caching) and vice-versa?
Though, I can answer that questions myself also, if I'll dig into that tools. Being bleeding-edge, and solving a lot of problems in "battaries-included way", Om tools require non-trivial effort to get into them. What a challenge How many time did it take for you guys to study, say, Om, based on beginner React and CLJS knowledge?
@andrewboltachev: https://www.youtube.com/watch?v=MDZpSIngwm4 should mostly answer you
@andrewboltachev: regarding your earlier question you could use local component state or app state…up to you, some like to avoid using local component state altogether. You don’t need to introduce any state though, as React components have local state (accessible via the component state methods https://github.com/omcljs/om/wiki/Documentation-(om.next)#set-state)
@drusellers: I believe David had said earlier that he thought there would be beta release around Feb/Mar
@steveb8n: i don't quite understand - isn't what i tried supposed to work? Could you clarify?
@smeister: yep, if you have a solution that’s good but you had a thread going with David about keeping transact! details out of the view code. fwiw that’s what you can see here https://github.com/stevebuik/om-next-ideas/blob/73e22ec9cab12d0caded6b012d74b80c14a9d1a2/src/cljs/om_next_ideas/app/views.cljs#L28
@steveb8n: thanks, i understand. I thought you would refer to my most recent problem (https://gist.github.com/SMeister/df825c11e958a26e741e)
@smeister: i tried to provide you an explanation for your problem: https://gist.github.com/SMeister/df825c11e958a26e741e
@janherich: the query passed to the read method for :item should be exactly [:ui/menus]. Where is the problem then? db->tree (i could also just use get here - makes no difference) reads the top level key and the parser gives me back the result nested correctly. The toplevel read was not meant to be called - it was just for illustration purposes.
My problem is that the re-render is successful only when i specify :ui/menus inside of the root query and i have no idea why. Initial rendering would not work if what you suggested were true, but it does.
@smeister: your problem is simply resolved by specifying the keys to re-read after transact!
#(om/transact! this '[(open) :ui/menus])
@anmonteiro: thanks! Now it works, but i am a bit confused. Why do i need to specify this inside of the subcomponent? I thought transacting on something would lead to a re-read of all keys in it's query. Also, why does specifying the key in the subcomponent's tx influence what happens after the root's tx?
@smeister: not really sure about the first question
but it might be related to the sequence of txns
" Also, why does specifying the key in the subcomponent's tx influence what happens after the root's tx?" because it also queues the child component to be re-rendered, and not only the root
@smeister: OK, so here's something else I found out
if your app state has the same structure of the queries
(which it doesn't in your gist)
then you don't need to specify :ui/menus
to be re-read
to clarify: your app-state should look like the following
{:item {:ui/menus false}}
what I said is a misstatement
I was still looking at a cached version
give me one sec
@smeister: so I take back what I said before, but your example is quite messed up to begin with
you define a read method for :item
but you're actually reading :ui/menus
there
anyway, to make it work you just need to specify :ui/menus
after the call to open
not even needed in close
the problem is that your app state doesn't match your queries
also not sure why you're using db->tree
since in this example you could just return st
sure, i did not replace it as the example was the trimmed down version of something bigger
@smeister: ok that makes sense
I've got to run now, but if you still have any questions maybe I can attend to them later
Hi. A newbie question: how do I start that app? https://github.com/swannodette/om-next-demo
I've done just lein repl
and then
user=> (require '[todomvc.core :as cc])
nil
user=>
user=> (cc/dev-start)
#<SystemMap>
user=>
I can see the HTML page, some items but when I perform actions I've got a lot of 500 errors like
HTTP ERROR: 500
Problem accessing /api. Reason:
java.lang.Exception: Not supported: class java.util.concurrent.ExecutionException
(but some of AJAX calls are successful, which is even more strange)@andrewboltachev: om-next-demo in it’s current state is not something to try and run yourself unless you are a very experienced Clojure(Script) dev
no intention of bringing it up-to-date on my end until more important Om stuff is sorted out
@dnolen: got it. I'll try to dig into it myself then. Thanks
Still don't get why i have to specify :ui/menus to be re-read in the subcomponent in https://gist.github.com/SMeister/df825c11e958a26e741e. Several people have told me now that it's because my app state does not mirror the queries structurally, but isn't the structure up to my interpretation?
in om.next
how can one disable printing transaction logs? At least temporarily. I have a huge logs that when printed slow down my app.
@denik i didn't try it out, but i think you can use the logger option for the reconciler to pass in something else, e.g. a logger which doesn't log at all. https://github.com/omcljs/om/blob/master/src/main/om/next.cljs#L1647
@denik: simply pass :logger nil
to the reconciler
@smeister: @anmonteiro Thanks that worked!
Is it possible to do a set-query!
after a transact!
? Background: I create something through mutations and after that my router likes to go there. My router works by changing the query of the root component which I can’t do in transact!
. Oh and it doesn't work by just calling set-query!
after transact!
but it works by defering the second call.
@maackle: wrt. issue #554, the query you're looking for is [({:message [:text]} {:size ?size})]
@dnolen: corrected a typo in the Links tutorial, here's the wiki diff: https://github.com/omcljs/om/wiki/Thinking-With-Links!/_compare/c006d0a1891df596ef307cc57936c2b01253e976...8f5852b2405b0a043e61aab14cd851d11857465d
@peeja Om Now?
I think the latest release of it was 0.9.0, which is under react 0.13.3
I think you can use an older version of Devcards?
I’m assuming this is more than I could probably tackle but how hard would it be to make the Om data structures compatible with core.reducers ala https://github.com/nathanmarz/specter/issues/46#issuecomment-168837093
following the discussion around issue #554 and general confusion about Om Next queries, I wrote something: https://twitter.com/anmonteiro90/status/684148857547165697
after applying @anmonteiro’s fix for unions + recursion
@dnolen: regarding #550, as @tony.kay mentioned, using devcards' dom-node
with add-root!
works for me
@anmonteiro: do you have example of this somewhere?
only @tony.kay 's comment
(defcard x-card
(dom-node (fn [_ dom-node]
(om/add-root! x-reconciler Component dom-node))))
@dnolen: if you just don't have the time, I can work on the boring task of removing mock-root
and updating all devcards examples
while you employ your time to something useful
yeah I’m definitely happy to see mock-root
go - it’s been an annoying thing to support
@anmonteiro: haha, sure if you want to take it - it should be pretty quick one
@dnolen: yes it will
give me some minutes
I'll be sure to add the dom-node
example to the commit message
@dnolen: I'll submit it as a fix for #550, is that OK?
@anmonteiro: You have time to chat over your patch real quick?
So, if you could glance at this: https://github.com/omcljs/om/pull/561/files#diff-7e4043f05bbd8e76d2da4614c2566cfaR1251
trying to decide if that reduce query depth should wrap the entire expression or just the query
@tony.kay: I'd say it looks okay
it wouldn't find '...
in union-seen
right,
union-entry
will contain e.g. {:tree/foo [:id :node/type :foo/value {:children ...}], :tree/bar [:id :node/type :bar/value {:children ...}]}
@dnolen: I did the rebase, all tests pass, and @anmonteiro and I agree that the conflict fix is correct with respect to our two patches.
@tony.kay: if we wanna be sure
add a number to my example in om.devcards.bugs
ns
rather, in om.next.tests
`
search for e.g. UnionFooNode
& re-run tests
Sure, let me do that. I was trying to grok what you were recording in the union-seen
@tony.kay: I record the last seen union-entry so that when there's recursion it can decide which way to go
ok, remembering to clean helps. @anmonteiro Yeah, I've verified the numbers work with I mess with your tests.
you mean "when you mess" or I didn't understand??
@tony.kay: where is it failing when you pass 0?
in my union stuff?
cool, then!
@tony.kay: good job