This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-21
Channels
- # admin-announcements (4)
- # beginners (41)
- # boot (46)
- # cider (8)
- # clojure (132)
- # clojure-austin (15)
- # clojure-belgium (3)
- # clojure-greece (3)
- # clojure-hk (1)
- # clojure-mexico (4)
- # clojure-quebec (5)
- # clojure-russia (46)
- # clojure-spec (225)
- # clojure-taiwan (1)
- # clojure-uk (17)
- # clojurescript (46)
- # clojurewerkz (1)
- # core-async (28)
- # cursive (9)
- # datascript (3)
- # datomic (5)
- # defnpodcast (42)
- # devcards (60)
- # emacs (27)
- # hoplon (7)
- # lein-figwheel (5)
- # leiningen (12)
- # mount (8)
- # om (13)
- # play-clj (2)
- # reagent (47)
- # rethinkdb (5)
- # ring-swagger (7)
- # spacemacs (9)
- # specter (12)
- # testing (1)
- # untangled (1)
- # vim (11)
- # yada (31)
so for example this:
(ns 'foo
(:require
[sablono.core :refer-macros [html]]))
(def css-transition-group (.. js/React -addons -CSSTransitionGroup))
(defcard css-grp
(om/factory
(ui
Object
(render [this]
(css-transition-group
#js {:transitionName "bar" :className "foo"}
(html [:h1 "Ooompha"]))))))
can anyone tell me how to make it work?@anmonteiro: A simple example would be something like:
(defui Offer
static om/Ident
(ident [_ {:keys [offer/id]}]
[:offer/by-id id])
static om/IQuery
(query [_]
'[:offer/id
:offer/customer-name]))
Given my app state contains an offer with a real id, how could I apply a transaction to persist a copy of it to a remote and assign the new id to the extant offer?
so I can’t even make something like this work: no sablono this time:
(def css-transition-group (.. js/React -addons -CSSTransitionGroup))
(def data ["Foo" "Bar" "Baz"])
(defcard css-grp
(om/factory
(ui
Object
(render [this]
(dom/div nil
(css-transition-group (clj->js {:transitionName "bar"
:children (map #(dom/h1 nil %) data)} )))))))
@ag: you need to call js/React.createElement
like this:
(js/React.createElement css-transition-group
#js {:transitionName "bar"
:children (map #(dom/h1 nil %) data)})
@donaldball: I would look at what om.next/default-migrate
is doing for tempids and do something similar for your use case
you can even return your mappings from the remote transaction as realid->realid2
as default-migrate
doesn’t enforce that keys in the tempid
map have to be om tempids
Thanks, that’s a good idea
I have a somewhat more elementary question at the moment. Suppose in my state I have an entity of which I have partial information (e.g. the id) and I need to fetch the rest of the data from a remote. Is this a use case for query params?
wondering what tools people are using currently for unit testing / integration testing using cljs and a react wrapper like om or reagent?
I think I have answered my question from earlier: in the read fn for these data, I can grab the identifiers and smuggle them to the send fn in the ast :params, and it seems to work fine, though I’m not sure if this is a good solution or not
@donaldball: probably how I’d do it too