This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-04
Channels
- # architecture (13)
- # bangalore-clj (1)
- # beginners (174)
- # boot (25)
- # cider (65)
- # cljs-dev (10)
- # cljsjs (4)
- # cljsrn (3)
- # clojure (169)
- # clojure-berlin (27)
- # clojure-brasil (32)
- # clojure-greece (3)
- # clojure-russia (31)
- # clojure-sg (4)
- # clojure-spec (6)
- # clojure-uk (74)
- # clojurescript (186)
- # code-reviews (5)
- # css (12)
- # cursive (17)
- # datascript (1)
- # datomic (45)
- # dirac (33)
- # funcool (42)
- # hoplon (25)
- # jobs (6)
- # jobs-discuss (114)
- # lambdaisland (6)
- # leiningen (1)
- # luminus (24)
- # off-topic (86)
- # om (13)
- # om-next (14)
- # onyx (75)
- # perun (2)
- # protorepl (19)
- # re-frame (2)
- # reagent (17)
- # ring-swagger (2)
- # rum (1)
- # slack-help (2)
- # specter (31)
- # test-check (5)
- # timbre (1)
- # untangled (34)
- # vim (8)
Question: I'm doing some dev testing with an atom that has nested values... (atom { :blurbs { 0 {:blurb/id 0 :blurb/title "Hey!" :blurb/content "Greeting message" }}})
What's the appropriate way to write a read function for nested maps? (subvec) I know is for vectors... I just discovered again the get-in
statement ... (get-in @atom [:blurbs 0 :blurb/title])
... I'm trying to turn this into a UI query expression ... any thoughts?
I'm not sure how to translate my atom-parsing into IQuery. My read function for :blurb/content looks like `(defmethod read :blurb/content [{:keys [state] :as env} key params] (let [st @state] (get-in st [:blurbs (:blurb-id params) :blurb/content])))` What would be the right thing to pass to om/IQuery in my ui component so I can render :blurb/content based on id?
nevermind, got it working. ... how can I make sure every component has a unique react key? I'm getting some funky errs
"react.inc.js:18745 Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of nonforum_starter_january$core$BlurbList
. See https://fb.me/react-warning-keys for more information." ...
did not mean to link that ^
just, the error about react-keys got me looking for solutions.
@sova to make sure each component has a unique key, declare a key function in the om/factory declaration: (def foo-component (om/factory Foo {:keyfn :db/id}))
How do you set the initial local state of an Om.next component?
To answer my question: implement Object (initLocalState [this] {:foo 42})
in defui
@drcode thank you that helps point me in the right direction...
@drcode ah you're a saint. what worked for me was (def blurb (om/factory Blurb {:keyfn :id})
because my elements already have unique :id
Question: if I am moving my app from an @atom to <datomic> then presumably all I need to change are my parser :readfn and :mutatefns, yes?