This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-19
Channels
- # admin-announcements (8)
- # beginners (90)
- # boot (69)
- # bristol-clojurians (3)
- # cider (32)
- # cljs-dev (2)
- # cljsrn (22)
- # clojure (45)
- # clojure-art (2)
- # clojure-poland (102)
- # clojure-russia (91)
- # clojurescript (38)
- # cursive (27)
- # datomic (45)
- # devcards (7)
- # emacs (45)
- # gorilla (25)
- # hoplon (3)
- # jobs (1)
- # ldnclj (7)
- # off-topic (4)
- # om (176)
- # onyx (3)
- # portland-or (7)
- # re-frame (12)
- # reagent (64)
- # yada (26)
Can anyone confirm if om 1.0.0-alpha22 is technically "stable" for the purposes of running om.now with React 0.14
I'd like to try https://github.com/JedWatson/react-select but it requires react 0.14 and om 0.9 release depends on 0.13
@olivergeorge: pretty sure the alphas aren’t good for om.now
I am kind of confused as to how :remote mutates work; I wrote a simple example based on @dnolen 's TodoMVC, but when I try to add an element the change isn't reflected on the client
i.e. I do (om/transact! s [(foo/create {:foo/name "new-name"})]
which goes to the remote fine, and if I update I see the new foo
The remote is is giving {:value [:foo/list]}
but that doesn't make it reload that? I also heard mention of using temp-ids with automatic reconcilliation in the clojure conj talk, as that what I should be using here? optimistic update on the client with temp-id?
@jamesnvc: {:value ...}
has no impact on re-render, it is only a suggestion. In a transaction, you'd append the key... so change your transact call to: [(foo/create {:foo/name "new-name"}) :foo/list]
If you want to see what components would be re-rendered based on :foo/list, do: (om.next/ref->components reconciler :foo/list)
in your repl.
Thanks @dnolen
morning people, does anyone have an example repository with Om.next + Devcards + Reconciler?
@wilkerlucio: I think @jannis has some devcards + om.next stuff
My Om Next devcards don't use the reconciler. But these do: https://github.com/omcljs/om/blob/master/src/devcards/om/devcards/tutorials.cljs
humm, thanks @jannis
I see this code uses a function om/mock-root
, interesting
thanks @martinklepsch, I was looking at @jannis code before, but like he said he wasn't using reconciler there
So I heard mention of this :tempid map in @dnolen 's Clojure Conj talk & I see where it gets called in om/next.cljs, but how do you actually use it? Do you make the action thunk return {:tempids {1 2}}
?
Generate tempids w/ (om/tempid)
. Then return {:tempids { [:thing/by-id tempid] {;thing/by-id real-id] } }
hello; how are you handling temporary input values on om.next? are you using it as some local state or putting it on a root pointer like :something/new
?
@wilkerlucio: either way could work, it really depends on whether you want to time travel on that state
thanks @dnolen, I'm gonna try using edit state in app state
How often should we be updating the Documentation page for om.next? I see set-params! still on there
I can update too, if ya'll want - I've been in lurking mode, because I don't know how things work yet
My action returns something like {:tempids {[:foo/by-id tmp-id] [:foo/by-id new-id]}
but I don't seem to see that reflected in the client
should I expect to see the id updated in the client though? I'm not even sure what I'm doing makes sense
but again I would only look at something minimal and complete that demonstrates the issue
I have no prior Om, React or ClojureScript experience and am going through the Om Next tutorial. Curiosity question... is there a way to call transact! in a for loop but still have the components re-render before the loop is complete? (for [x (range 1000)] (om/transact! reconciler '[(increment)])) This logs the transactions to the console but my Counter component doesn’t re-render until the loop is complete.
@balduncle: I don't think so, by design; React only re-renders on requestAnimationFrame, precisely so it doesn't have to repeatedly re-render 1000 times
@balduncle: and no you don’t want do that (clarified)
should it be possible to call update-state!
from a componentWillUpdate
? I'm getting a No queries exist for component path
error when I try to do so
I've found that when I have a component that receives modified props that are partially from Om.next + extra data, then I update the component state, all props are lost in the next render cycle, is that normal?
@wilkerlucio: that’s another anti-pattern
If you had a constant stream of data coming in that needed to be transacted I assume it wouldn’t lock up the UI if it was coming in super fast…?
I have a list that loads async from the server. I want to set a local :selected-item
attribute when the list first loads for a default selection
@balduncle: the whole point of rAF is who cares how fast the data is coming
@dnolen: nice, that's what I was looking for, thanks
dnolen: I won’t even see that though if my loop is stopping rendering from happening, right?
@balduncle: yes but that doesn’t have anything do with Om
@dnolen: using om/computed
the computed properties are kept after a state update, but props are still being lost, this is intended?
@wilkerlucio: doesn’t sound plausible
@wilkerlucio: you’re just not allowed to modify props periods
@dnolen: I'm not trying to modify props, I'm updating the component state, I have a minimal case for the issue, let me paste for you
on this component, when you click at the button the props go blank
@wilkerlucio: yeah so that won’t work
@wilkerlucio: and this is alpha22?
@wilkerlucio: yeah your parse won’t work
I don't understand the relation of the parser with the problem that I'm trying to point out
@wilkerlucio: nothing will work if you don’t supply a parser
because the parser here is just supposed to be a mock to get something that works
Sorry to keep asking questions about the same thing here, but I see that my action returns {:tempids …}
, but the return value of the thunk doesn't get sent to the client? It is very possible I am misunderstanding how this is supposed to work
@wilkerlucio: the problem is the parser is broken
why when I update the child state it loses the props? I'm trying to understand this
@wilkerlucio: the components gets its props … from the parser
@jamesnvc: the return the value of the thunk is never sent to the client that’s not how mutations work
@dnolen: okay, that makes sense to me; I was confused how :tempids could possibly work in the way I was understanding
@dnolen: thanks, working with a fixed parser
I guess I have to use something other than the datomic primary key as the id though? Since I need the result of the thunk to figure that out?
@wilkerlucio: the parser builds the UI
@dnolen: Hey David, I had an idea for merge-tree that might help things out quite a bit...let me know if you have a few to chat abt it
no biggie. I'm going to spend the next few days writing docs. I've written stuff down in issues
I don’t see any challenges but want to make sure the API bits for manipulating queries is solid enough for this
ok, will do. I'll work up an example that shows what I'm thinking...doing that for the docs anyhow
We often need to write merge-tree, since the UI tree doesn't match the structure or the app state, right?
e.g. the response from the server has to look like UI tree, but that isn't what is in our app state.
and we can leverage the parser to address this complexity (since we already have the query we sent, and the parser)
sorry, I am assuming that you write you read-style functions to call parser recursively
it also doesn't require new code, really...but it gives nice help with the merge-tree problem