This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-27
Channels
- # bangalore-clj (1)
- # beginners (11)
- # boot (23)
- # business (2)
- # cider (43)
- # cljs-dev (65)
- # cljsjs (17)
- # cljsrn (4)
- # clojure (144)
- # clojure-austin (4)
- # clojure-berlin (3)
- # clojure-finland (4)
- # clojure-nl (2)
- # clojure-russia (13)
- # clojure-spec (73)
- # clojure-uk (42)
- # clojured (2)
- # clojurescript (166)
- # core-matrix (4)
- # cursive (24)
- # datomic (39)
- # dirac (8)
- # hoplon (97)
- # jobs (2)
- # jobs-rus (11)
- # juxt (16)
- # lein-figwheel (8)
- # leiningen (1)
- # luminus (5)
- # lumo (46)
- # off-topic (1)
- # om (39)
- # onyx (43)
- # overtone (1)
- # pedestal (3)
- # perun (6)
- # play-clj (3)
- # protorepl (14)
- # re-frame (21)
- # reagent (25)
- # remote-jobs (1)
- # ring (1)
- # robots (4)
- # rum (13)
- # specter (5)
- # untangled (72)
- # yada (62)
so when that field gets set to some ident, the component renders a child component through which the entity is supposed to be edited
Because my presumption is that I can somehow resolve this ident within this child component
I'm implementing a drag/drop within SVG. Within the untangled/om-next model, how is this to be done? The thing that confuses me is: while the mouse button is held down, anad the mouse is being moved, what queries should I be firing off?
@qqq: My experience is that its not great to use app state to store something like current mouse position - its too slow. Best to use local state. There's an example of using local state in the cookbook recipies.
I guess local state until mouseUp, then when window ahs dropped, record the new x/y coordiantes, but not the intermediate mouse movements
when the user closes the browser and re-opens, I want the windows to be in the same place
what is the right place to attach "validation" functions? so for example, suppose I have a defui which has an input box in one case, I only want valid phone numbers in another case, I only want valid zip codes in a third case, I only want multiples of 3 so now I have a function which is of type "String -> Bool" how do I parameterize a defui with this function?
The above is where the validation functions are. Clone that repo and read about them.
there is a :validator tag in om/factory, but for what I need -- it's more callback ish, andI need om/computed instead
Question about using the router (0.7.0 client code) - I have a message list that I am loading on scroll from server to client and the post mutation for this involves appending the new message/by-id records from a load cache to the message lists data structure. When I place the message list under the router, am I correct in thinking that the existing mutation then needs to know about the changed location of the message list records being held under the router structure or am I missing something?
Ignore the above - I think I've worked it out, my message list component needs an ident and then I can reference it correctly from the mutation by passing this ident through!
@urbank Don't mistake core.spec as a replacement for anything. It is a new capability. Another tool in the toolbox. Untangled spec is a set of wrappers around clojure/cljs.test that make testing a bit simpler in terms of what you have to write/read.
@lucasbradstreet @sova thanks! Hope I don't disappoint 😉
@urbank on your question about queries. It is not particularly clear. I'd recommend watching the getting started videos. Many people have found them helpful in getting an understanding of things.
best to give a simple example of a database as a data structure, and the query you're trying to do
Yeah, I wasn't put off. I can see how that tone was implied 🙂 Was just going to watch them again, because I sometimes see new things when rewatching with new knowledge
So, basically I'm coming here from trying out datascript with posh, where a database can be arbitrarily queried from a component. So I probably have some incorrect intuitions that don't apply to om/next / untangled. Anyway, an example:
Yes, a component in Om Next will mainly query what makes sense in the context of that component (as if the state were local to it). The link queries are very rare, and should typically be reserved for asking for global singleton things, like current user.
I mean, you can do what you want, but I don't recommend trying to use the query language as a general purpose datascript query language.
the joins in the Om Next db format (idents) will be followed by joins in the query. So you can make it work. But you only get auto denormalization from a server if there is a component at every join
And you can use defui to just define queries/idents (no UI). So, you can do more complex things that way.
@tony.kay Hah I think I got it! Trying to formulate a question seems to help often 🙂
So apparently I was ignoring om/Ident . If I define an EditItem component with an ident pointing to items/by-id and give it the same query as ItemRow, it resloves correctly. I also need to compose the query of EditItem into ItemsTable
Now, so far all my components have idents... so that might be a red flag given what you wrote above (if I understood it correctly)
`[:table/type {:editing (om/get-query ItemEdit)} {:items (om/get-query ItemRow)}] <- So :editing resolves to an Ident [:items/by-id 1] whereas :items remains :items ... it doesn't resolve into [[items/by-id 1] [items/by-id 2]]
@urbank formulating the question correctly is what's up.
@urbank Yes, :editing resolves to an ident because you've queried it as an abstract scalar property
:items is queried as a join, so you should see the real items (e.g. it should follow the idents and give you back the objects with just the sub-properties that the item queries ask for)