This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-10-10
Channels
- # announcements (3)
- # babashka (3)
- # beginners (83)
- # calva (1)
- # cider (19)
- # clojure (131)
- # clojure-austin (4)
- # clojure-dev (3)
- # clojure-europe (49)
- # clojure-greece (2)
- # clojure-italy (8)
- # clojure-losangeles (18)
- # clojure-nl (14)
- # clojure-poland (1)
- # clojure-uk (65)
- # clojurescript (28)
- # core-async (7)
- # core-logic (3)
- # cursive (2)
- # data-science (1)
- # datomic (98)
- # defnpodcast (1)
- # figwheel-main (6)
- # fulcro (95)
- # graphql (5)
- # hoplon (7)
- # kaocha (1)
- # lein-figwheel (6)
- # luminus (1)
- # nyc (1)
- # off-topic (21)
- # pedestal (1)
- # quil (8)
- # re-frame (15)
- # reagent (106)
- # reitit (15)
- # shadow-cljs (158)
- # sim-testing (1)
- # spacemacs (17)
- # sql (25)
So I'm trying to render a simple unordered list with data from an api, but for some reason I'm getting this error
Error: Objects are not valid as a React child (found: object with keys {takes, dirty_takes, puts, dirty_puts, buf, closed, add_BANG_}). If you meant to render a collection of children, use an array instead.
in coding_test.website.core.list_comp 2 react-dom.inc.js:13951:28
Which I don't understand because when I test the render function list-comp
with some test data it returns the correct result
(into [:ul] (map #(bike-station (:name %)) data)) => [:ul [:li "Stortingstunellen"] [:li "Professor Aschehougs plass"] [:li "Borgenveien"] [:li "Enerhaugen"]]
Hmm, it seems like this is a core async problem. I tried making a render function with the test data and it works as expected, but when I (println stations)
I'm getting what I expect
Does someone have a clue who would be responsible for submitting this (in our case a 527kB) goog.addDepencency -evaluation to the browser when a file has been loaded with (load-file
or a new connection is made to the REPL?
This same information is repeated multiple times making the whole thing hang for substantially long time. I’ll try to dig this up somewhere, just thought I’d ask around if someone has an answer right away 🙂
At least add-dep-string
from the compiler seems to be doing that, so maybe I’ll start there.
That evaled dependency JS has 919 lines of goog.addDependency(<some-file>, [<list of deps>], []);
. I know this must be needed to be sent, but not multiple times, so something is triggering way too often.
It seems that the payload is not the same, actually, but most of the content is.
you identified the add-dep-string
correctly. why it is sending so much I don't know though.
I'll have to dig into this. We have a fairly large project, but I don't think it really should be necessary to send this much information on every load
(not to mention the duplicate information)
@U05224H0W this thing is due to the load-file
loading the dependencies for each :require
in the file that has been loaded. There’s a great deal of redundancy in this calculation, I’m currently contemplating if I can take some time to come up with a better approach and make a PR out of it.
The “culprit” is the cljs.repl/load-dependencies:260
that just basically mapcats all deps and pushes them out one by one.
(nth (js/Uint8ClampedArray. [0 1 2 3]) 0)
nth not supported on this type function Uint8ClampedArray() {
[native code]
}(first (js/Uint8ClampedArray. [0 1 2 3]))
0,1,2,3 is not ISeqable(set! (js/Uint8ClampedArray. [0 1 2 3]) 4 4)
Error in phase :compilation
invalid dot form
Indeed, if you enable the checked array access feature in the compiler, it will not balk on things that satisfy goog/isArrayLike
(it turns out Uint8ClampedArray
satisfies that predicate).
hmm, i don't think i needed to enable such a feature in order to use aset
/`aget` on typed arrays. maybe shadow-cljs did that for me? or have i misunderstood you?
No, I’m just saying that if you use aget
and aset
on Uint8ClampedArray
values, the compiler & runtime will be OK with it, even if the consumer of your code enables the checked array access feature.
For example see https://github.com/clojure/clojurescript/blob/5ad96a8b3ae2e3616a19715ba9ba2471a36933a2/src/main/cljs/cljs/core.cljs#L456
ah i see. reading your post on this is also informative 🙂 https://clojurescript.org/news/2017-07-14-checked-array-access
I’m working with ImageData
objects. Those arrays can be pretty big - mike, do you have any tips for working with these data structures?