This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-30
Channels
- # babashka (46)
- # beginners (234)
- # bristol-clojurians (4)
- # cider (7)
- # clj-kondo (39)
- # cljdoc (8)
- # cljs-dev (10)
- # cljsjs (10)
- # cljsrn (24)
- # clojure (84)
- # clojure-brasil (7)
- # clojure-europe (12)
- # clojure-germany (4)
- # clojure-italy (3)
- # clojure-nl (41)
- # clojure-spec (17)
- # clojure-uk (66)
- # clojurescript (64)
- # conjure (161)
- # cursive (12)
- # data-science (45)
- # datomic (20)
- # devops (11)
- # docker (2)
- # duct (9)
- # events (7)
- # figwheel (1)
- # figwheel-main (20)
- # fulcro (32)
- # graalvm (5)
- # helix (82)
- # jackdaw (9)
- # jobs-discuss (19)
- # kaocha (11)
- # local-first-clojure (1)
- # malli (6)
- # meander (3)
- # nrepl (12)
- # off-topic (2)
- # other-lisps (15)
- # pathom (14)
- # rdf (6)
- # re-frame (8)
- # reactive (1)
- # reagent (5)
- # reitit (4)
- # rum (3)
- # shadow-cljs (77)
- # spacemacs (3)
- # sql (9)
- # test-check (31)
- # tools-deps (13)
- # vim (62)
- # xtdb (18)
Thank you for that, @lilactown. Since Helix is yours, I wonder if you might know why using a basic Helix entrypoint in core.cljs (in that exact repro repo) causes Helix to fail to compile, too: https://gist.github.com/tekacs/a46476615782a45f29005d15bc0f27b7
which begs the question: WTF is the out/main.js
that the CLJS http server is serving?
Hmm — I took out/main.js from the CLJS splash screen that came up on a build with no index.html
Would love to see it. I looked over the parcel docs and couldn’t find where you put the config file. And my experiments kept failing with not finding goog
I have a bunch of shadow projects -- last week it took me two days to go from an empty directory to a fairly large, working project -- so I'll probably write that setup up soon. That said, I'd love to get this setup to be comfortable too and to maintain making it easy for people to get started with this stuff for a while -- because for all folks' complaints about CLJS tooling, I've had an infinitely easier time of it (with shadow, admittedly) than I had with a great deal of JS bundling (even CRA!).
these are Parcel 2 docs by the way, @lilactown: https://parcel2-docs.now.sh/
I can confirm that properly generating the main.js using parcel fixes the issue above
that makes sense @lilactown -- I'll push ahead on that approach then and see how it goes 🙂
had it served nothing I would have thought it was wrong immediately, but I assumed that it was safe to use the file that hadn't been pre-processed -- it's unclear why a broken main.js exists there -- perhaps it's left over from another build target but is in a broken state on the :bundle one?
@lilactown is that parcel 1 or 2? (heard yall talking about doc version)
the only thing I didn't immediately see when glancing through parcel 2 docs was how to change the output file
bundle-cmd {:none ["npx" "parcel" "build" "out/index.js" "--out-dir" "out" "--out-file" "main.js" "--no-minify"]
the only thing I couldn't figure out was how to pass the NODE_ENV through the bundle-cmd
80 (for [a (range 10) b (range 10)]
^--- Wrong number of args (3) passed to: cljs.core/for
81 [:div a]
82 [:div b]
83 )
Hello, Any idea how to return two hiccup form in one loop? Thanks.Wrap them into vector and then use flatten on the result. Smth like this:
(->> (for [a (range 10) b (range 10)]
[[:div a] [:div b]])
flatten
(into []))
Or if you only need to flatten one level:
(->> (for [a (range 10) b (range 10)]
[[:div a] [:div b]])
(apply concat)
(into []))
flatten is almost always wrong. just an example:
Clojure 1.10.1
user=> (for [x ["foo" "bar" "baz"]] [:div [:h3 "stuff"] x])
([:div [:h3 "stuff"] "foo"] [:div [:h3 "stuff"] "bar"] [:div [:h3 "stuff"] "baz"])
user=> (flatten (for [x ["foo" "bar" "baz"]] [:div [:h3 "stuff"] x]))
(:div :h3 "stuff" "foo" :div :h3 "stuff" "bar" :div :h3 "stuff" "baz")
@lilactown Thanks, it’s exactly what I am looking for.
there's a simpler answer
user=> (for [a (range 10) b (range 10) div [[:div a] [:div b]]] div)
([:div 0] [:div 0] [:div 0] [:div 1] [:div 0] [:div 2] [:div 0] [:div 3] ... ... ...)
you never need to concat the result of for, you can lift the result into a clause and emit it element by element
I have the following code:
(deftest test-async
(let [result (waitFor (+ 1 2))
;; landing (<p! (waitFor
;; #(see/landing!)
;; ))
;; click (<p! (waitFor
;; ;;#(see/landing!)
;; #(interact/click-login-btn)
;; ))
]
(async done
(go
(is (= 3 (<p! result)))
(prn "done")
(done)
)
)
))
But this gives me:
ERROR in (test-async) (Error:NaN:NaN)
expected: (= 3 (<p! result))
actual: #error {:message "Promise error", :data {:error :promise-error}, :cause #object[TypeError TypeError: Cannot read property 'current' of undefined]}
"done"
Seems related to this: https://github.com/testing-library/react-testing-library/issues/439
But my versions of react and react dom are the same and latest
Then why this error?Is it possible to produce a source map that isn't written relatively to the output-dir, but also isn't included in sourceMapURL? I am uploading the sourcemap to a service which processes them. I see now why this is a problem :)
what is the best way to achieve the kind of routing implemented by react-router where when you click a link on any page, the browser does not perform a reload? I was thinking a potential way of doing this is creating a reagent component that encapsulates a HTML <a>
tag that receives click events but calls (. e preventDefault)
on them. Does anyone here have thoughts on this?
I don’t know about the best way, but I’ve used https://github.com/clj-commons/pushy
Yeah, when I made my first SPA a few years back I just went with the secretary and accountant. Pretty painless to set up, but it's one of the those things everyone has to figure out for themselves unless they use a batteries-included frontend framework.
Try reitit