This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-11
Channels
- # announcements (14)
- # beginners (119)
- # boot (9)
- # calva (7)
- # cider (12)
- # cljdoc (2)
- # cljsrn (28)
- # clojure (127)
- # clojure-dev (2)
- # clojure-europe (3)
- # clojure-italy (2)
- # clojure-losangeles (9)
- # clojure-nl (6)
- # clojure-spec (15)
- # clojure-uk (39)
- # clojurescript (35)
- # community-development (4)
- # cursive (9)
- # datascript (8)
- # datomic (5)
- # duct (3)
- # emacs (10)
- # fulcro (45)
- # graphql (3)
- # jobs (1)
- # kaocha (8)
- # luminus (2)
- # off-topic (121)
- # onyx (3)
- # pathom (15)
- # pedestal (31)
- # planck (5)
- # reagent (25)
- # reitit (3)
- # remote-jobs (1)
- # shadow-cljs (48)
- # slack-help (1)
- # sql (142)
- # tools-deps (78)
I could actually see the props data structure change in React DevTools. but React did not re-render the component
I can’t think of how two CLJS structures could be different but referentially the same
Check the compiled JS
I’m not sure if reagent implements it’s own shouldComponentUpdate
and that might be at fault?
Is it an ratom or a reaction? In really complex apps I have seen amazing spooky action at a distance caused by a missing doall in completely unrelated parts of the application impacting reactions
(defn fragment
[{:keys [id]}]
(let [content-data (data/pull! :styx
{:from "fragmentEdition" :id id}
{:contentful/raw true})]
(fn []
(if-not (:loading @content-data)
(render {:id id :content-data (:data @content-data)})
[:div "Loading..."]))))
🙂I think we've had a bug pop up a couple times a quarter related to form-2 components since we started using reagent
specifically, a dev doesn't repeat the props in the fn arguments. or doesn't remember to use a form-2 component
@lilactown yeah, your form-2 will bite you there
and just for completeness to this question:
> I’m not sure if reagent implements it’s own shouldComponentUpdate
and that might be at fault?
Reagent does implement shouldComponentUpdate
for you, if you don’t (via a form-3 component). You can see it here:
https://github.com/reagent-project/reagent/blob/v0.8.1/src/reagent/impl/component.cljs#L160
In a form-1 or 2 component, you wouldn’t have your own shouldComponentUpdate
, so it’d be the (nil? f)
branch of the cond
.
@lilactown Ohhh I thought about form-2 components when you first said this but thought it the obvious thing so I never said anything 😞 I was using reagent/with-let
instead of form-2 components, since it avoids this situation entirely…
it’s hard too because this is someone else’s code on my team, so I’m playing the game of telephone with ya’ll
Hello, anyone know how I can make this work:
<Sidebar.Pushable as={Segment}>
What I have is:
(:require [reagent.core :as r]
[soda-ash.core :as sa])
...
[sa/SidebarPushable {:as (r/as-element [sa/Segment])}]
but that gives me an error: "Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: <Segment />. Did you accidentally export a JSX literal instead of a component?"Getting rid of the :as
seems to work [sa/SidebarPushable (r/as-element [sa/Segment])]
@urbanslug Take a look at my comment in this issue: https://github.com/gadfly361/soda-ash/issues/10
Thanks @gadfly361