This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-14
Channels
- # aleph (14)
- # bangalore-clj (2)
- # beginners (39)
- # boot (18)
- # carry (7)
- # cider (37)
- # cljs-dev (1)
- # cljsrn (4)
- # clojure (74)
- # clojure-austin (12)
- # clojure-canada (6)
- # clojure-conj (15)
- # clojure-dev (3)
- # clojure-greece (14)
- # clojure-italy (1)
- # clojure-korea (1)
- # clojure-poland (3)
- # clojure-russia (5)
- # clojure-spec (22)
- # clojure-uk (13)
- # clojurebridge (9)
- # clojurescript (231)
- # cursive (2)
- # datascript (9)
- # datomic (12)
- # devcards (2)
- # emacs (2)
- # events (4)
- # hoplon (28)
- # off-topic (35)
- # om (61)
- # onyx (8)
- # parinfer (8)
- # proton (1)
- # re-frame (53)
- # reagent (10)
- # ring-swagger (8)
- # specter (11)
- # untangled (3)
- # vim (4)
What is the difference between
(def user-section
[:div {:class "header-column header-column-valign-top"}
[:nav {:class "header-nav-top"}
[:ul {:class "nav nav-pills"}
[:li
[:a.clickable {:class "rowLanguage" :on-click (fn[_] (set-locale :en-GB))} (i18n/translate :english)]
[:span "-"]
[:a.clickable {:class "rowLanguage" :on-click (fn[_] (set-locale :es-ES))} (i18n/translate :spanish)]]
[:li "goToAccount"]
[:li "login"]
]]])
(def main-section
[:div {:class "header-row"}
[:div {:class "header-column"}
user-section]])
and
(def main-section
[:div {:class "header-row"}
[:div {:class "header-column"}
[:div {:class "header-column header-column-valign-top"}
[:nav {:class "header-nav-top"}
[:ul {:class "nav nav-pills"}
[:li
[:a.clickable {:class "rowLanguage" :on-click (fn[_] (set-locale :en-GB))} (i18n/translate :english)]
[:span "-"]
[:a.clickable {:class "rowLanguage" :on-click (fn[_] (set-locale :es-ES))} (i18n/translate :spanish)]]
[:li "goToAccount"]
[:li "login"]
]]]]])
In the second case when I click, the language is translated, but in the first not, and I can’t know why 😔the only difference that I can see is that in the second case I separate the code in two methods…..
@dzannotti: http://stackoverflow.com/questions/39320524/om-next-mutate-of-other-component-state-not-causing-other-component-to-re-render/39413526#39413526
@cjmurphy are you saying that i should trigger an dummy transaction to force a refresh (remote) from my component?
I’m using om.next with re-natal, and I’m getting a curious error when transacting inside an onPress handler in a ListView.
null is not an object (evaluating ‘new cljs.core.Keyword(null,”history”,”history”,-247395220).cljs$core$IFn$_invoke$arity$1(cfg).add`)
It’s obviously referring to
https://github.com/omcljs/om/blob/e5d3e2e7d56185e07b9a9d7c46bf88c3f2cba247/src/main/om/next.cljc#L1554
Could something be overriding the .add
method of whatever (:history cfg) returns?
I’ll go out on a limb and tag @anmonteirothere are some wrinkles in React Native
I would probably check if (om.next/get-reconciler this)
has a value in the component you’re transacting from
if it’s nil
it confirms my suspicions
Oh damn, that will probably be it. Having some trouble compiling, so I might have to check on this again tomorrow
Any suggestions on how to proceed if your suspicions are correct?
@levitanong the first attempt I would make would be to try out omify
it sets up the correct bindings for plain React components
so before using a ListView
or w/e it’s called, you’d (omify! ListView)
or something
@anmonteiro Interesting! looking forward to trying that out 😄 Thanks man!
no docs yet, but have a look at the tests or the devcards
Will do!
@anmonteiro any suggestions on how to trigger a refresh (with remotes) for a specific component?
@dzannotti hrm, you’ll probably have to roll your own, until this is a thing: https://github.com/omcljs/om/issues/485
@levitanong Are you creating components outside render
? om.next binds *reconciler*
and other dynamic vars when it calls render
.
I've had issues where I pass functions to React Native components and they get called outside of render
, which results in those components having nil
returned from get-reconciler
.
I'm using a macro similar to this one to make sure I get the om.next vars bound:
https://github.com/hugoduncan/navigator-repro/blob/master/src/navigator_repro/macros.clj
Usage: https://github.com/hugoduncan/navigator-repro/blob/68bbd63588cc109897452ee6cadbf13bbc0bf1a9/src/navigator_repro/core.cljs#L147
@levitanong can you provide more context wrt #804?
doesn’t work where? client or server? which function?
maybe even a minimal repro
@anmonteiro Sorry about the terseness of #804. Doesn’t work on client, I haven’t tested it on server.
…
Object
(componentDidMount [this]
(println (om/react-ref :foo)) ;; returns nil
(println (om/react-ref “bar”))) ;; returns the component
(render [this]
(dom/div nil
(dom/div {:ref :foo})
(dom/div {:ref “bar”})))
@levitanong what if you call it like this: (om/react-ref “:foo")
(just trying to narrow down the issue)
to be clear, have the :foo
ref as a keyword, but look it up as a string with :
@anmonteiro Well that’s weird, I can’t reproduce it anymore.
Thing is, this has happened before. Will close the issue, will reopen and look for “:foo” when it happens again.
@petterik Thanks for the advice! I will take a look at that as well, when I figure out why my simulator isn’t connecting to figwheel anymore 😛
@levitanong FWIW I think Boot-React-Native gets more updates than re-natal https://github.com/mjmeintjes/boot-react-native
but I haven’t been following closely
@anmonteiro I’ve looked into this also, but the react-native version is still far behind 😞
gotcha, just wanted to make you aware of that project in case you weren't
seems like you got it covered though
Thanks 🙂 Though it seems I don’t got it covered at all. Ugh, leiningen.
Oy, vey! I figured it out. IP address issue.
@anmonteiro Just tested om/get-reconciler
. Yep, it’s returning nil
@petterik Your suggestion worked with one modification! I had to remove the macro-ness of it, and use it as a plain function. When I was using it as a macro, react was complaining that it was expecting valid react components, when it was instead receiving cljs.core/let
. This is unsettling though. Like, is the macroexpansion happening at the wrong place?
@petterik scratch that, my mistake! Forgot to make my util namespace .cljc
. Sorry for the noise! Also, you have my thanks! Your advice was spot-on.
what’s the “right” way to force a (remote) query for a component?
@solussd Are you looking for this? https://github.com/omcljs/om/wiki/Documentation-(om.next)#force
I saw that, I’m not sure, really. I guess what I really want is to perform an arbitrary query and have the result get integrated
@solussd I think you'll need to perform a mutation in that case
@solussd I think you’re looking for the same thing someone asked earlier today, probably still in the backlog. Anyway, the answer is you’ll have to roll your own thing until this becomes a thing: https://github.com/omcljs/om/issues/485
can I transact without a mutation (only reads wrapped with force)?
well that’s an interesting one. I’ve never tried it, but should be possible in theory, I think
@solussd if that turns out to work, maybe it even obviates the need for touch!
That's the whole setup of Untangled isn't it?
having a brief look at the code suggests that it might indeed be possibile. Interesting
@anmonteiro, I actually don’t care about the component, specifically. I need to force re-reading some data in cases where sideloaded data fails for whatever reason. (I.e., perform optimistic update/mutate remote that kicks off an async change, track the fact that it was an optimistic update and, if after some amount of time I don’t get the new value sideloaded, e.g. via sse, I want to explicitly re-read from the remote)
cool, well, I can try it. 🙂
@solussd let me know how it goes!
will do!