This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-02-06
Channels
- # adventofcode (1)
- # aleph (9)
- # announcements (22)
- # beginners (59)
- # boot (8)
- # calva (1)
- # cljdoc (7)
- # cljs-dev (10)
- # cljsrn (9)
- # clojars (10)
- # clojure (23)
- # clojure-dev (6)
- # clojure-europe (3)
- # clojure-italy (26)
- # clojure-nl (3)
- # clojure-seattle (1)
- # clojure-spec (46)
- # clojure-uk (85)
- # clojurescript (97)
- # core-async (13)
- # cursive (3)
- # data-science (10)
- # datomic (156)
- # duct (34)
- # emacs (37)
- # figwheel (3)
- # figwheel-main (9)
- # fulcro (59)
- # hyperfiddle (4)
- # immutant (1)
- # jackdaw (3)
- # jobs (1)
- # off-topic (112)
- # parinfer (1)
- # qlkit (2)
- # re-frame (1)
- # reagent (35)
- # ring-swagger (2)
- # shadow-cljs (104)
- # spacemacs (9)
- # speculative (12)
- # tools-deps (30)
- # yada (10)
I think I was over thinking it. I should be able to get the behavior I need just by allowing the user to nest my component in their hiccup forms
`ws` package must be installed to use `react-devtools`.
I get this warning even on a production build. Is there a way to have cljs built with things looking for process.env.NODE_ENV factored out?After upgrading to ClojureScript "1.10.516" I get a warning when figwheel tries to reload my code: Can't take value of macro cljs.core/and
, when the code looks like this:
(when (and beg end) ,,,)
but the warning goes away if I do this:
(let [both? (and beg end)]
(when both? ,,,))
... could be something to do with the new type inference?this only happens when figwheel tries to reload my code tho, not when it initially builds everything - so there's something weird going on for sure.
The Day8/re-frame-debux
lib mentions I should replace day8.re-frame/tracing
with day8.re-frame/tracing-stubs
when doing production builds (as the /tracing one might hurt dead-code elimination), but doesn't elaborate how to achieve this. Is there any tricks for replacing a lib just when doing a uberjar
build but not otherwise?
Yes, here’s what’s in our project.clj
file:
:profiles
{:uberjar {:dependencies [[day8.re-frame/tracing-stubs "0.5.1"]]
:omit-source true
,,, ;; etc
:dev [:project/dev :profiles/dev]
:project/dev {:dependencies [[day8.re-frame/re-frame-10x "0.3.3"]
[day8.re-frame/tracing "0.5.1"
,,, ;; etc
yogthos did something with it recently https://github.com/yogthos/semantic-ui-example
it wants you to initialize certain components on the page with jQuery calls, which I can't get working
i had the bright idea to just add the call I needed to :component-did-mount
like so ^{:component-did-mount #(.dropdown (js/$ ".ui.dropdown"))}
but apparently that's not correct either
isn't it simpler to use semantic-ui-react instead? it doesn't require jQuery, so should have less footprint
and it looks like there .dropdown
probably just want's an element, so you could use a vanilla js .querySelectorAll
, or goog.dom/getElementsByClass
semantic-ui-react is jQuery free and there appears to be several straightforward wrappers for it on clojars, first and foremost cljsjs.semantic-ui-react
semantic-ui-react works pretty well with reagent/re-frame
Just hit up against https://dev.clojure.org/jira/browse/CRRBV-15 when trying to run some doo
tests in one of our cljs projects. Does anyone happen to know a workaround?
Michal fixed and cut a new 0.0.14 release today
if someone can supply a patch, happy to help get it applied/released
Can a ClojureScript defmulti be queried? VM1169:1 Uncaught TypeError: cljs.core.methods is not a function
It can, the name is munged, my bad cljs.core.methods$
okay, which leads me onto my next question. Is returning js/undefined
the only way to emulate a function without a return
?
I seem to have found a bug, but I'm really not sure where to even start (and I really don't have time right now), but does anyone ever lose global vars inside a deftest
block? The following code:
(prn 1 validate!)
(deftest test-example
(prn 2 validate!)
...)
prints
1 #object[consigncloud$policy$pos$validate$validate_BANG_]
Testing my.test.ns
2 nil
Although I'm really just swapping out the reporter, and I haven't had a problem like this in a while. Odds are I've made some mistake
try (js/console.log ...)
if it really goes away or your printer/reporter maybe just gets confused
When I (prn v!)
inside the test it gives me
#object[consigncloud$policy$pos$validate$validate_BANG_]
[Function: consigncloud$policy$pos$validate$validate_BANG_]
(ns x (:require [y :refer [validate!]])
(def v! validate!)
(prn v! validate!) ;; => function, function
(deftest test-x
(prn v! validate!) ;; => function, nil
)
My test case is very much tied together with other code, if I continue to have the problem I'll try to put together an isolated test case. Unfortunately I've got a time crunch, so I'll use the redefinition trick for now
something that may mess up the tests when they actually execute? since the initial prints all run when the code is loaded
so if something messes with the namespace objects after they have been loaded that will break stuff
Not much, I'm not super good at namespace/var manipulation. I do use binding
with a different var from the same namespace, and elsewhere in the calling namespace I use ns-publics
for an unrelated ns
Yeah, apparently all js fns return undefined if nothing else
@thheller I tracked down the problem; I was in the midst of a refactor, and a namespace was clashing with a var named the same as the last segment of that namespace exported from another namespace with the same first few segments. To make that concrete, the warning I got eventually was: Namespace consigncloud.policy.pos.validate clashes with var consigncloud.policy.pos/validate
. So it was a weird thing I was doing. But I did experience some buggy behavior, first, I wasn't getting that warning until I had removed half my source code, so I'm not sure why but something was suppressing it. Second, I only experienced the bug because of what I assume are internals of dependency resolution order; I removed a completely unrelated file and my code started working.
Anyhow, I'm good to go, is there anywhere I might report that but? I'm not sure I can produce a test case for it since it involves a lot of my code. Definitely one of those hard-earned pieces of wisdom that I'll remember though 😅
hehe yeah those things can be tricky. I wish namespace weren't built like that but its too late to change that now 😞
not sure why you wouldn't get the warning immediately but I suppose compilation order matters for that
so I finally succeeded in getting Clojurescript to build under Bazel, with an external Closure library and so on.
but I'm getting double-inclusion, and I'm possibly grabbing the wrong files. I want cljs to output everything but the Closure core bits
I can find the files with just my own code, but they depend on the cljs core library.
oh, cljs.core is a Closure library; I can probably include those separately.
is that a question? CLJS compiled code always depends on cljs.core since the collections and stuff live there
I discovered more files than I thought were generated; I think I grabbed a "big" file instead of the "small" one.
yeah. the objective here is to let Bazel do the combining and compilation; I want just my code as a Closure library with goog.require
statements.
linking in the goog.base and cljs.core libraries is done externally, here.
I realize this is against the grain of the usual CLJS build style; but it's more important to fit with the much larger grain of Google's build system.
you shouldn't combine output from different compiles that may cause issues when they came from different versions
yeah, it's Bazel that's causing difficulty here
I've got it grabbing the right, standalone files now.
the cljs.main run produces both the simple JS files and bigger ones that include cljs.core and goog.base already.
you only need to run :optimizations :none
if you are going to process them anyways. no need to run :simple
it was several weeks ago I first took a crack at this; I thought the :none
output didn't have the goog.require
s?
I guess I can try it