This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-13
Channels
- # beginners (99)
- # boot (2)
- # boot-dev (4)
- # chestnut (2)
- # cider (75)
- # clara (43)
- # cljs-dev (1)
- # cljsjs (6)
- # cljsrn (4)
- # clojars (2)
- # clojure (76)
- # clojure-brasil (1)
- # clojure-france (1)
- # clojure-italy (2)
- # clojure-spec (30)
- # clojure-uk (4)
- # clojurescript (39)
- # core-async (1)
- # core-logic (2)
- # cursive (1)
- # data-science (7)
- # datomic (14)
- # docker (12)
- # emacs (6)
- # fulcro (69)
- # garden (4)
- # hoplon (7)
- # jobs-discuss (46)
- # leiningen (3)
- # lumo (3)
- # off-topic (12)
- # om (2)
- # parinfer (12)
- # perun (9)
- # re-frame (44)
- # reagent (6)
- # rum (1)
- # shadow-cljs (73)
- # specter (5)
- # unrepl (10)
- # vim (2)
I'm building a library for a pretty specific use case that's gonna have a lot of functions to import. Is there at least some kind of macro hack I can put together to import a bundle of functions in one go?
I have been using scope-capture
in a cljs-repl
via piggieback
& figwheel
- all newest versions and haven’t had any problems.
Then suddenly today the cljs repl seems to not know how to analyze the sc.api/spy
macro from scope-capture
anymore.
This is only in one project. However, I’ve made new projects to minimize it with the same compiler/figwheel settings and I get no problem.
When in cljs-repl (via piggieback + figwheel)
cljs.user> (require 'sc.api)
nil
cljs.user> (sc.api/spy :foo)
---- Could not Analyze <cljs form> line:1 column:1 ----
at line 1 <cljs repl>
1 (sc.api/spy :test)
^---
---- Analysis Error ----
nil
I just am wondering if there is anything to do to help troubleshoot a case like this.
I’m even able to dig into the fn object some from the same REPL
cljs.user> sc.api/spy
#object[sc$api$spy]
(js-keys sc.api/spy)
#js ["cljs$core$IFn$_invoke$arity$2" "cljs$core$IFn$_invoke$arity$3" "cljs$core$IFn$_invoke$arity$4" "cljs$lang$maxFixedArity" "cljs$lang$macro"]
I can even call these functions and get back expected results.So for some reason, it is just failing to analyze it as a macro. However, it seems like it is project-specific. I just don’t know what to tweak to try to dig out the issue
I think I need to do some work to get a hook into the analyzer around where it is failing to see what is going on. Seems pretty opaque though.
I think that it is coming out during the macro expansion during analysis. I wish there was a way to at least get a stack trace from the REPL when the analyzer fails like this though. Maybe there is…
question : i have this dependency i installed with npm (it's lovefield)... It is a google library and was done according to the closure library way. I'm doing a nwjs application with it. As such, i'll just rely on the standard packaging for nwjs applications, so i do not want to append that library inside my js code when doing advanced compilation. But there is a provided lovefield.externs.js file in the node_modules/lovefield/dist directory. -Using lein, how would i go about notifying clojurescript that the externs file is right there ?
@carkh the :externs
compiler option should find it if you specify :externs ["node_modules/lovefield/dist/lovefield.externs.js"]
wrote a post about capturing ClojureScript errors on the server https://yogthos.net/posts/2018-01-12-ClojureScriptErrorPropagation.html
curious if anybody knows why using :npm-deps
doesn't work with stacktrace-js source mapped stacktrace when using advanced compilation
(the deref should actually be a prop to another component, etc, but that's my minimal reproducer)
seems like the two explainatinos are: 1. on-click is calling itself repeatedly OR 2. :ref is calling itself repeatedly and 2 seems more likely than 1
but there are some re-agent examples that do pretty much exactly that, and supposedly work
which is why I'm asking how refs are supposed to work with reagent, for anyone who might have used them
I can remove the on-click and it works just fine, because it has absolutely nothing to do with it
@qqq - I know it's because ref keeps changing. That's not the question. The question is about how it is supposed to work with reagent.
ah, sorry, I misread your question; I'll let someone more familiar with reagent handle this
(defn dropdown-menu [props & children]
(let [open (r/atom false)
ref (r/atom nil)
handle-click (fn []
(swap! open not)
(. js/console log "State of ref atom: " @ref))
handle-ref #(reset! ref %)]
[:div
[:button {:on-click handle-click
:ref handle-ref}
"Ho ho"]]))
my guess is because the line (let [_ (.log js/console "State of ref atom: " @ref)]
is somehow executing during assignment, which triggers the component and causing it to keep on re-render.
one useful thing I learned is to declare all the definitions (`atom`s) and methods in the let
block, this makes things easier to define and track. 🙂