This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-04
Channels
- # admin-announcements (36)
- # beginners (54)
- # boot (74)
- # cider (14)
- # cljs-dev (91)
- # clojure (197)
- # clojure-austin (1)
- # clojure-conj (3)
- # clojure-india (5)
- # clojure-japan (3)
- # clojurescript (111)
- # core-logic (12)
- # cursive (6)
- # datascript (3)
- # datomic (16)
- # devcards (26)
- # events (1)
- # funcool (11)
- # hoplon (63)
- # jobs (2)
- # ldnclj (10)
- # lein-figwheel (6)
- # luminus (5)
- # nginx (7)
- # nyc (3)
- # off-topic (1)
- # om (148)
- # onyx (122)
- # portland-or (5)
- # re-frame (3)
- # reagent (25)
- # yada (15)
i've noticed that when i have my parser return {:value nil}
, a component that uses that respective key in its IQuery
impl just doesn't render. given the use of :not-found
in the quick start, i assume this is not entirely unexpected behavior, but it's still surprising to me...i'm curious if there's some background i'm missing
Hi, this is my first attempt to use Om Next. Disclaimer, I am a beginner. I want to build a form that shows additional fields (questions) when certain inputs get toggled. https://gist.github.com/leontalbot/1d57bb05c063a989757c
Don't really know how to do the mutation to add question id to :questions/visibility
Anybody have suggestions (and advice to improve my bad coding)?
@maravillas: just don’t return nil
for now
@dnolen: I know you said it's awkward to use Datomic if not using JVM but I'm wondering whether the hassle of using it outweighs the benefits it provides as it would be awesome to use it. I found this https://github.com/edubkendo/datomex but this is using the REST API of Datomic. Which the whole point of Om Next is to move beyond REST am I right?
@grounded_sage: moving beyond REST is a non-goal, the point is just to not use it when it’s a bad fit - rich client apps
@grounded_sage: I can’t speak definitively about the Datomic REST interface you should ask on the #C03RZMDSH channel for more informed opinions
roger that
Cheers. Will do. Just good to confirm the Om Next side of things
(going to sleep)
@leontalbot: you are very close. You just need to think about your app state as a database. In :questions/visibility
you want the elements to be idents and then everything should just work. I would make sure you really understand the normalization wiki page.
@dnolen what do the cognitect people use for a lot of your front end apps? Have you guys started to move towards using om?
@dnolen has there been much discussion of best practices of how to model things like widget-specific properties, such as what has focus? Or editing existing "model" values. You can do it in the app state, or you can do it locally, in the component state, i.e. react state. My preference on my projects has been keeping as much state as explicit as possible, and in the app state, usually datascript-backed. However, I was interested in what other people have found.
@taylor.sando: the only real answer to that is “it depends"
anybody that says otherwise is just focusing on their own problems and not looking at the bigger picture
but avoiding component local state unless absolutely necessary is a good rule of thumb
I could see local state being used for very component-related things, such as d3 properties.
hmm any thoughts on the following? I have a map. Whenever the user moves the map, I want to pass the lat and long to my server so that the server can return information based on that
From what i have read, your query is like (:some-namespace/fn-name {param: val}), wrapped in transact call, om/transact!
Your mutate function needs to specify that it is a remote call. The currents docs aren't great for demonstrating how remotes work.
@dvcrn: seems like you want to encode something like :user-lat-lng
or something like that then there is a key that hold extra info that can be read
to re-phrase my question: My component tree looks like this:
RootComponent -> MapComponent -> MapPinComponent
Queries:
- MapPinComponent: [:id :lat :long]
- MapComponent: [{:app/pins ~subquery}]
Now what should the RootComponent do? Can I just do something like: [~subquery]
or would it be smarter to embed everything inside a :app/data
field? [{:app/data ~subquery}]
Is there any rationale (debunked or not, just want the argument), for not using cursors with Om Now? Best I can find is http://diogo149.github.io/2014/10/19/om-no/, but I'm not clear this is problem likely to bite or not.
man this is complex. I have a python backend and writing something that is able to understand everything is really difficult. Does anyone here already have something working in python that I could peek into?
@dnolen: Thank you! It makes sense I'll go through the normalization wiki page.
@jonpither: nobody wrote up anything that was particularly precise about the problem. but I can summarize.
a) users had to be aware of the caching nature - and thus had to understand issues of asynchrony
b) hardwired a particular storage mechanism (in-memory EDN tree structure) - challenging to wire in new storage. the default made it difficult to model identity
it’s very likely that neither of these problems are insurmountable - but the co-located query approach delivers the same conceptual functionality while solving both of these issues and bringing a lot more benefits
@dvcrn: can’t argue with using Clojure but also curious about what makes this so hard in Python
is there a way in the repl to see the javascript that the om component will render? (using react-native)
I am trying to add a NavigatorIOS to my app and I am pretty sure I am doing it incorrectly. here is my code, error at the bottom
@iamjarvo: FWIW I also couldn't add a NavigatorIOS to a react native app
the problem is the passProps property
it expects a JS object as props
but then passing a JS object as props to an Om component doesn't seem to work
@anmonteiro: is your code on github?
it is not
which bits would you like to see?
I have since deleted that since I assumed it wasn't possible
and switched to using the Navigator
also,you didn't share your code
in your message above
maybe by mistake?
yea it was a mistake https://gist.github.com/iamjarvo/a69f1bf39d1adac6dda4. This is what you are using now? https://facebook.github.io/react-native/docs/navigator.html
yes, more examples here: https://github.com/facebook/react-native/tree/master/Examples/UIExplorer/Navigator
oh you're not using Om Next
is it your first time using Om?
I think your "search" component should be a function of 2 arguments
(defn search [owner]
this is how it looks like
maybe it's not required, I don't remember
yea I really don't remember, at a first glance this was what smelled to me
anyway, the error you're getting, I think it's pretty generic
I've also struggled with React Native's errors when using clojurescript
ATM I haven't been able to have it report e.g. Om's runtime errors
I am thinking the error I am getting is due to a javascript error and the code is bailing at that point
it's what I'm trying to say
let me try out your example
can you see anything else printed in the console?
anyone gotten devcards working with om.next, specifically with lein-figwheel?
@jeremyraines: Look back through the history of messages for the kanban stuff from Jannis
ok. I’m looking at their source now. Two issues I’m hitting is 1) they use boot, and I’m using lein-figwheel, and I’m finding I have to run lein cljsbuild
to have the cards stuff build, rather than figwheel handling. Also the browser doesn’t connect to the repl on the cards page. 2) My defcard
looks like theirs, but I get Invariant Violation target container is not a DOM node
@jeremyraines: I'd suggest getting figwheel and devcards to work without om.next first. It seems like you're having trouble setting things up, so I'd start solving that first.
I am just part way done with a fairly nested UI backed by datascript and I'm consistently getting query time warnings. Everything is rolling up to the root component. I've seen talk about Ident creating an independent query path, however the primary use case seems to be normalizing data which I don't need. Is there a solution to this that I'm missing?
@jannis OK, trying with a sablono one. Can you help me understand what’s wrong with this? I still get the invariant violation:
clojure
(defn foo []
(sab/html [:div {} "hi"]))
(defcard simple-component
"Test"
(foo))
@jeremyraines: defcard
expects a function that creates a React element, not a React element.
if you’re always rolling up to root you’re definitely misunderstanding the basics - to be fair it’s not obvious and you should ask questions and people will answer when they have time
@jannis: same error. I’m also confused about that statement b/c I’m looking at this: https://github.com/bhauman/devcards/blob/master/example_src/devdemos/two_zero.cljs#L71-L85
@jeremyraines: You're right, sorry. It should be able to handle that.
hmm, ok. thanks for your help so far. your kanban project is a great resource. Going to try going back a version or several to see if I can land on a working version
@jeremyraines: It's certainly not an Om Next problem but might have something to do with how you're setting up devcards. Calling start-devcard-ui!
in the right place, passing :devcards true
to the cljs compiler. Stuff like that I would investigate.
thanks
@jeremyraines: I think it may be easier to follow the devcards Readme. Jumping into the middle like this is always going to be painful
Thanks @dnolen, fair enough on queries rolling up to the root being me misunderstanding. I'd appreciate anyone pointing me to an example where an alternate method is used, the ones I've seen seem to to all roll up to root. @tony.kay in his tutorial also states "The overall query must compose towards (one or more) root".
I’m doing my best to do so. I can’t use the most basic part because I have an existing lein-figwheel project.
most of what I have is copy-pasted from the README
@bplatz: (one or more) is in case you have more than one om-next app on the same page (e.g. targeted at different divs with add-root!)
@jeremyraines: I suggest taking this to #C09GR9UJC.
you may need to create a query expression to move control down and make your application more modular
Thanks. I make extensive use of iQuery on (most) components, and roll up using om/get-query to build a large nested graph. Most components are represented using a join, and I recursively call the parser to get the nested joins (in order to simplify/distribute the read functions).
I'll review docs an examples again to see if I'm missing something. My concern is that I'm already at 20+ms query time and just part way done, although the app itself does not seem laggy.
@dnolen Perfect, that was my question. I had seen some talk that components implementing Ident could do that and was asking if that was the case (as my use of datascript seems to obviate the need for Ident).
@bplatz right you’ll still want to be able to run the narrowed query regardless of DataScript/default DB
@jeremyraines it might be sablono causing the error too. I recommend installing a sablono snapshot locally (the snapshot version has updated react deps) and also I had to exclude react from devcards deps.
good to know — thank you
are there any thoughts yet wrt migration paths from Om Now?
I assume I can’t just mix components of the different versions in the tree?
after things settle down will spend some time on it, at the least will support both in the same repo for forseeable future
Cool, thanks for the update.
Just out of curiosity, can someone who knows Relay and/or Falcor give me a quick yes/no if they are also friendly for client-only data stores, like Om is? (Exploring options for a dayjob javascript project which won't have a remote back end)
@drcode: looks like Falcor would be OK with local storage… https://netflix.github.io/falcor/documentation/datasources.html
yes Falcor should definitely be, Relay should be as well though - https://facebook.github.io/relay/docs/interfaces-relay-network-layer.html
@dnolen: Planning to support recursive pull notation ala Datomic? E.g. [:a :other {:c ...}]
I remember you showing an example, but I'm on alpha 14 and it just says it is not ISeqable
added a simple way to abort parsing in the case of some unrecoverable issue https://github.com/omcljs/om/commit/fec028c433e7fb5acd97e2a3a4a6f9ddd10465df