This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-03
Channels
- # beginners (48)
- # boot (26)
- # cider (7)
- # cljsrn (1)
- # clojure (137)
- # clojure-nl (1)
- # clojure-spec (5)
- # clojure-uk (18)
- # clojurescript (26)
- # cursive (8)
- # datascript (4)
- # datomic (4)
- # defnpodcast (11)
- # docker (1)
- # duct (7)
- # figwheel (4)
- # fulcro (7)
- # off-topic (7)
- # re-frame (46)
- # reagent (40)
- # reitit (3)
- # shadow-cljs (4)
I'm getting an error when SSR'ing a Union (the Union works as expected in JavaScript but when I reload the page the SSR bombs out):
1. Unhandled java.lang.IllegalArgumentException
No matching field found: displayName for class
clojure.lang.AFunction$1
Reflector.java: 308 clojure.lang.Reflector/invokeNoArgInstanceMember
primitives.cljc: 3380 fulcro.client.primitives$merge_alternate_unions$merge_union__39719/invoke
Line 3380 of fulcro.client.primitives
reads:
(log/warn "WARNING: Subelements of union " (.. parent-union -displayName) " have initial state. This means your default branch of the union will not have initial application state.")
Searching fulcro.client.primitives
source code (Fulcro 2.1.6) for displayName
reveals a reader conditional in a function (which seems to suggest it's ClojureScript only):
(defn component-name
"Returns a string version of the given react component's name."
[class]
#?(:clj (str (-> class meta :component-ns) "/" (-> class meta :component-name))
:cljs (.-displayName class)))
@maridonkers Ah, yeah, that is a problem. The warning is probably unnecessary anyway. I think it is obvious that you won’t get initial state if you don’t add initial state. I removed that and pushed it as a snapshot 2.1.7-SNAPSHOT to clojars
@tony.kay Thanks. That does indeed sound obvious 🙂
hey all, how do I attach a method to a defsc
component similar to the following using defui
:
(defui MyComponent
Object
(my-method [] ...)
(render [this]
(my-method)))
attempted to just add it into the map of options passed to defsc
(similar to a react lifecycle method) but that doesn’t seem to be working