This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-16
Channels
- # announcements (2)
- # architecture (3)
- # beginners (72)
- # cider (15)
- # cljs-dev (27)
- # clojure (85)
- # clojure-berlin (3)
- # clojure-dev (4)
- # clojure-europe (7)
- # clojure-italy (7)
- # clojure-nl (6)
- # clojure-uk (17)
- # clojurescript (63)
- # clojutre (10)
- # core-async (10)
- # cursive (10)
- # datomic (34)
- # events (4)
- # fulcro (3)
- # funcool (8)
- # incanter (1)
- # jackdaw (1)
- # jobs-discuss (6)
- # joker (4)
- # kaocha (7)
- # leiningen (8)
- # nrepl (6)
- # off-topic (11)
- # reagent (8)
- # shadow-cljs (119)
- # spacemacs (11)
- # sql (11)
- # vim (30)
- # yada (2)
hi, i'm trying to create multiple javascript files. i have multiple cljs files. is there something i should know about :cljsbuild in project.clj ?
I try doing lein cljsbuild particle
and i have a build :id particle
pls halp 😄
Oh, subtasks are different than build IDs
nevermind i didn't have to do anything
spoke too soon: Uncaught ReferenceError: goog is not defined
@sova you're gonna have to give more context for people to be able to help you. What does your compiler configuration look like? What command are you using? Are there any warnings or errors during compilation? Are you targeting a browser or something else?
My guess would be your :asset-path
is wrong. Check in your dev tools in the network tab if you are getting 404s
hi, im using firebase from cljsjs, and after building for production either with optimization :advanced
or :simple
, im getting TypeError: firebase.$h is not a function
. I remember it worked well when i was only using firebase's auth, but now using firestore as wel as storage it started failing with this error. What am i missing?
Looks like you are missing externs https://clojurescript.org/guides/externs
hmm, https://github.com/cljsjs/packages/tree/master/firebase This seems already done with this lib
I’d say you have to check that APIs that you are using are actually covered by externs
also set :infer-externs true
in compiler options
and put (set! *warn-on-infer* true)
in the beginning of ns where you interop with firebase library, so compiler will print warnings if it’s unable to infer externs
(-> (js/firebase.storage) (.ref) (.child (str "stuff/" user-uid)) (.put image) (.then (fn [snapshot] )))
yep looks good
@U0FR82FU1, wow, i was missing :infer-externs true
in my cljsbuild config. How did it then work with firebase auth without this option? 🙂
because cljsjs firebase includes externs
infer-externs is to infer externs by the compiler
yeah, but now with this option, after compiling for production everything works (firestore, storage..). Before, without the option, only auth worked. This is what I don't get
that means that externs file in firebase package only describes auth part of the library and externs inference is able to infer missing externs
nice, thank you very much @U0FR82FU1
Clojure 1.9 should be the latest version that supports Java 7. According to the change log, Clojure 1.10 is the first version that mentions requiring Java 8: https://github.com/clojure/clojure/blob/master/changes.md
I have the rather special case that the component generated by React.memo
has to be passed as child to another component - but it should not be rendered while doing so.
The error I get is Unknown element type #object[Object] found while parsing hiccup form: [object Object]
I know the part about not using (react/memo =)
as I was skimming through the issues 🙂
{:wrap [(react/memo (fn [a b] (= (->clj a) (->clj b))))]}
Is what I do (Using cljs-bean
)
It is passed as a child to https://react-window.now.sh/#/api/FixedSizeList
Where we have the special case of using the component as something like: <List>{Component}</List>
instead of directly rendering it by <List><Component /></List>
So when I use the hiccup: [FixedSizeList {...} MemoizedComponent]
i get the error shown above - but only if the memo is applied
can you try just rendering the memoized component real quick? that error doesn’t make sense given what I see so far
[ClipListItem {:index 0
:style {:height "50px"
:background-color "blue"}
:data {:clips [{:text "foo" :_id "bar" :time (.local DateTime)}]
:is-item-loaded? (constantly true)
:selected? selected?
:toggle-selected toggle-selected}}]
Renders as expected@lilactown When I print out ClipListItem
to the console without the memo I get: myclipse$clip$views$ClipListItem[props maybe-ref]
and with memo I get {$$typeof: Symbol(react.memo), type: ƒ, compare: ƒ}
there might be something about this?
Sadly I have only a few minutes left today to look into this. It is not so pressing as its a personal sideproject though. I was just wondering if you or someone else would know about this issue @lilactown 🙂 Maybe I'll find a workaround another time
@lilactown Thank you for your time as well!
@lilactown I think I tracked it down to the hiccup interpretation of hx
:
#?(:clj Object
:cljs default)
(-as-element [el config]
(cond
((:is-element? config) el) el
:default
(throw
(ex (str "Unknown element type " (pr-str (type el))
" found while parsing hiccup form: "
(.toString el)))))))
As a component itself is no react element, this does not allow to pass an unrendered component as a child to a component like react-window
wants you to and throws an Unknown element type
error instead.The is-element?
seems to use https://reactjs.org/docs/react-api.html#isvalidelement which returns false for components themselves but true for generated elements (Component instances)
yeah, I’m a bit confused why it would fail that because it’s not actually in a hiccup form
I'm not sure if its good practice to do that but I believe that react allows anything to be passed. Here it kind of makes sense as usually, the child would be a function (Which is a known pattern) but when you memoize the child function, what you get is a component
I guess it would be either letting the user pass anything - or handle this specific case. I don't know what is better 😄