This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-04
Channels
- # aleph (4)
- # bangalore-clj (1)
- # beginners (89)
- # boot (16)
- # braveandtrue (4)
- # cider (1)
- # cljs-dev (6)
- # cljsrn (90)
- # clojure (132)
- # clojure-austin (1)
- # clojure-dusseldorf (4)
- # clojure-italy (12)
- # clojure-portugal (2)
- # clojure-spec (13)
- # clojure-uk (41)
- # clojurescript (142)
- # code-reviews (19)
- # conf-proposals (1)
- # datascript (6)
- # datomic (7)
- # graphql (12)
- # jobs-discuss (3)
- # keechma (23)
- # leiningen (3)
- # lumo (22)
- # off-topic (7)
- # om (21)
- # onyx (8)
- # parinfer (46)
- # pedestal (3)
- # perun (3)
- # re-frame (10)
- # reagent (30)
- # ring (1)
- # rum (2)
- # spacemacs (1)
- # sql (2)
- # testing (17)
- # yada (32)
@juhoteperi worked with :data-uk-*
, thanks a lot
so how do I debug a (reagent-based) site that spits out a js error in production but works perfectly in development mode? (app.js:1352 Uncaught TypeError: b.Xh is not a function)
thanks @gadfly361, yes makes sense. uh not too many, but I'm trying to make mine a PWA and the service worker file is in plain js.
@kaosko Any time you use a javascript method or object name within clojurescript, the google closure compiler could potentially munge the name, so like (.fooBar ....)
could get renamed to b.Xh
. So if you call anthing from that plain js file in cljs, you still may need to add an extern. As far as a package via cljsjs, sometimes there are missing externs too. To add externs, first go to the clojurescript build in your project.clj
:cljsbuild {:builds [{:id "prod"
:source-paths ["src/cljs"]
:compiler {:output-to "resources/public/js/compiled/app.js"
:optimizations :advanced
:pretty-print false
:externs ["externs.js"]}}]}) ;; < -- add this
then create an externs.js file in the root of your project's directory. then add externs to that file, for example
var $ = function(){};
thanks @gadfly361!
@jfntn I did something like this by writing atom->reaction
function:
https://github.com/metametadata/carry/blob/143877b3e07f2d530ed0923f2f81cc06a94c5413/contrib/reagent/src/carry_reagent/core.cljs#L5
@metametadata ah I almost had that but was just returning the ratom, why is the reaction necessary?
in that context I wanted to be really strict about the type 🙂
mutating the ratom would make no sense
so it would be better to throw an error if user tries to mutate the returned object
(reaction is read-only)
Is there another way to directly interface with a reaction, setting its new value like watches would do?
@dimovich that's a workaround... more idiomatic would be to use lifecycle methods properly to achieve what you want to do
@pesterhazy thanks
@jfntn there could be some low-level/private API.. What's the use case?
Same use-case really, but would like to minimize the performance overhead since the atom is updated a lot
@jfntn 1) Maybe it's not really a problem as no data is really copied on updating the ratom which watches after an atom? 2) I also don't think there's a way to get less "notifications" from the atom. Otherwise, the produced ratom/reaction can "miss" state updates.