This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-02
Channels
- # announcements (12)
- # babashka (7)
- # babashka-sci-dev (46)
- # beginners (35)
- # biff (1)
- # calva (4)
- # cider (22)
- # clj-kondo (48)
- # clj-on-windows (4)
- # clojure (132)
- # clojure-europe (161)
- # clojure-germany (1)
- # clojure-nl (2)
- # clojure-uk (5)
- # clojurescript (39)
- # conjure (10)
- # core-typed (1)
- # cursive (48)
- # datalevin (6)
- # datascript (12)
- # datomic (9)
- # emacs (5)
- # events (1)
- # figwheel-main (2)
- # honeysql (7)
- # hyperfiddle (35)
- # improve-getting-started (8)
- # introduce-yourself (4)
- # london-clojurians (1)
- # off-topic (20)
- # podcasts-discuss (1)
- # re-frame (45)
- # reitit (5)
- # releases (2)
- # rum (7)
- # shadow-cljs (20)
- # spacemacs (4)
- # tools-build (58)
- # tools-deps (19)
- # xtdb (56)
For development purposes I think it would be great if the serversideprops function emitted to nextjs would interface with the local nrepl process and invokes the jvm based version of the server side props function. Because it's nice to at least have repl based development for the server side part
I https://github.com/huygn/remix-cljs next-cljs to add basic Remix support (page & loader
, can easily add action .etc), but will needs to move away from :npm-module
target as it's quite deprecated
:npm-module is not deprecated. it'll stay as is. just seems like the newer :esm should be used given that all remix/next examples use ESM code
agree esm is the way to go, just that current :esm requires exports to be pre-defined which I think is a bit verbose, would be great to have per-fn :export like in :npm-module as it fits nicely with remix/next page files as they needs certain exports. I will try using custom target to see how it go
I'm using re-frame-http-fx but I don't seem to find where to sent the Content-Type header on the request, according to the docs using request-format to json-response should do it, but checking the request it still appears as Content-Type: application/x-www-form-urlencoded;charset=utf-8
The code in this realworld implementation should provide answers: https://github.com/jacekschae/conduit/blob/master/src/conduit/events.cljs#L192-L202
I tried :headers {"Content-Type" "application/json" }
but did not work
Hello! I wonder if there is a lib already that allows adding <clojureScript></sclojureScript>
or <script type="text/clojurescript">
tags directly to HTML?
Borkdude just keeps creating :star-struck:
Hello, I got an exception trying to print a clojurescript value with either js/console.log
or info
from timbre, which I cannot easily debug. Is this a known issue and is there an easy way to get around it? Any clue would help.
I haven't stumbled upon such issues before. If you can't figure it out, try creating a minimal reproducible example. Apart from letting other people try to figure out what's going on, it may improve your own understanding as well.
Ok, I will try to do that.
Forgot to mention, it only happens in a production build, not in dev.
eh I really don't know how I could debug this. I can't print it, I can't postmortem it either since it's a production build and I can't connect cider to it. It sounds like an extern issue somewhere, but shadow-cljs isn't giving me any warning.
There are instances where none of the build tools help. E.g. when you do stuff like (let [x (first ^js some-js-array)] ...)
.
externs issues are easy to confirm by just using shadow-cljs release app --pseudo-names
@U05224H0W well hmm... it happens in a fulcro error handler so it recursively throws, so the error is a maximum stack size exceded
ok, I'll try that
--pseudo-names doesn't fix the issue. Can I then assume it's not a extern issue?
I think I still need some help with this kind of function:
(defn obj->clj [obj]
(if (.isObject js/goog obj)
(-> (fn [result key]
(let [v (goog.object/get obj key)]
(if (= "function" (goog/typeOf v))
result
(assoc result key (obj->clj v)))))
(reduce {} ^js/Array (.getKeys goog/object obj)))
obj))
Even after importing (:require [goog] [goog.object]
in my namespace, when I evaluate (obj->clj js/navigator)
I just get :repl/exception
back, and I'm not sure how to progress.
Moreover, I'm not sure why I can use both js/goog
suggesting that goog
is a global object, and goog/typeOf
, suggesting that goog
is a namespace.This seems to do something:
(ns my.ns (:require [goog :as g] [goog.object :as o]))
(defn obj->clj
([obj] (obj->clj obj #{}))
([obj seen]
(if (and obj (g/isObject obj)
(not (contains? seen obj)))
(-> (fn [acc k]
(let [v (o/get obj k)]
(if (= "function" (g/typeOf v))
acc
(assoc acc k (obj->clj v (conj seen obj))))))
(reduce {} (o/getKeys obj)))
obj)))
probably not exactly what you want... one problem is that js/navigator
is self-referencing (so I introduced a seen
set). Anyhow HTH 🙂https://clojurescript.org/reference/google-closure-library#using-google-closure-directly explains usage of goog.object
FWIW my guess is that if you us the js/goog
style with advanced compilation it will fail, as the name would get munged... but I haven't tested that. The reason it "works" at all is just because they happen to overlap in your environment, but you shouldn't rely on that IMO.
You might also find the cljs-bean library interesting
Thank you very much @U06S1EJPL! In the meantime I had hardcoded a depth limit to avoid the self-reference, but your solution is better! I'll check cljs-bean 🙏