This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-18
Channels
- # architecture (25)
- # beginners (57)
- # boot (3)
- # cider (38)
- # clara (6)
- # cljsrn (6)
- # clojure (54)
- # clojure-china (4)
- # clojure-greece (1)
- # clojure-italy (3)
- # clojure-romania (1)
- # clojure-russia (7)
- # clojure-spec (68)
- # clojure-uk (46)
- # clojurescript (73)
- # community-development (2)
- # core-async (7)
- # cursive (17)
- # datomic (143)
- # duct (2)
- # emacs (12)
- # events (5)
- # figwheel (3)
- # fulcro (15)
- # hoplon (19)
- # jobs (12)
- # jobs-discuss (85)
- # nginx (3)
- # off-topic (111)
- # onyx (7)
- # other-languages (1)
- # re-frame (30)
- # reagent (19)
- # remote-jobs (1)
- # ring (7)
- # rum (1)
- # shadow-cljs (18)
- # spacemacs (4)
- # specter (4)
- # sql (24)
- # test-check (1)
- # unrepl (10)
- # vim (6)
- # yada (1)
@josh_tackett After thinking about your issue I’m convinced that is a bug and I opened one up against cljs-http. Hopefully I’m not wrong about that. 🙂 https://github.com/r0man/cljs-http/issues/112
@lee.justin.m Glad to hear we help make the library better!
I am using emacs/cider/fighwheel to develop cljs on a Ubuntu machine and having intermittent issues where files are not compiled on save and newly created files are not visible to the compiler. I am periodically seeing broken symlinks appear in my project folder name as other files in the folder but prefixed with .#. I should maybe also mention that my repo is in a Dropbox subfolder. Any idea what might be going on? I can't find any mention of symlinks with a .# prefix anywhere.
the .#
prefix is an emacs temporary saved file where it saves a copy of your buffer because you haven't saved it
@dpsutton Yeah, just discovered that. It is actually a lock file (in realty a broken symlink) that prevents double edits. I have disabled it to see if this fixes the issue.
good luck then. if you're in a git repo can you do this outside of a dropbox synced folder then?
you mentioned you were in a drop box folder. just mentioning that if you have a repo, you probably have some remote git location. the only reason i bring it up is that it might be weird with a file watching process like figwheel
Yeah, that is my next step if this doesn't solve the issue. Thanks for bringing it to my attention. Thing is that it has worked flawlessly for a long time.
It seems that :import
doesn’t work as I expect in :
(ns foo.bar
(:import [goog.i18n NumberFormat NumberFormat.Format]))
(NumberFormat. Format.CURRENCY)
;; => #object[ReferenceError ReferenceError: Format is not defined]
Using (:import goog.i18n.NumberFormat.Format)
, however, works.
Is this a known limitation of :import
?that's not a valid import syntax in clojure or clojurescript
try (ns foo.bar (:import (goog.il8n NumberForma) (goog.il8n.NumberFormat Format)))
@noisesmith This bug was made harder to track down b/c defining a function w/ Format.CURRENCY
didn’t even raise a warning. In fact, for some undefined Foo
,
(defn money [n]
(let [fmt (NumberFormat. Foo)]
(.format fmt n)))
;; => WARNING: Use of undeclared Var cljs.user/Foo at line 2
#'cljs.user/money
but
(defn money [n]
(let [fmt (NumberFormat. Foo.Bar.Baz)]
(.format fmt n)))
;; => #'cljs.user/money
What’s up w/ that?I have no idea - all I know is that having a . in the middle of a symbol on the right hand side of an import sublist isn't a documented syntax
hi folks. i’m trying to use :npm-deps, but running into what seems to be a pretty basic bug. details: https://gist.github.com/robert-stuttaford/f314c78c5bd88e98be17fb259543128e cc @anmonteiro
my question: am i doing something daft, or is this a bug?
@U2J4FRT2T thanks
I have arraybuffer response type and "chunked" Transfer-Encoding, to get the body of the response, would it make sense to convert the arraybuffer to #js [] array and concat the incoming chunks and convert it back to arraybuffer (Uint8array). Or concat arraybuffers togeather. This seems to be a streaming problem I can't find much about online. psudeocode:
(aset xhr "onreadystatechange"
(fn []
(reset! stream (conj @stream (.-response xhr)))
(when (= (.-readyState xhr) 4)
(prn "ready" (new js/uInt8array @stream)))))
@hlolli Have a look into Fetch API
Is supports streaming out of the box
do you want to process incoming chunks one by one?
If I am getting TypeError: Path must be a string. Received false
when using :npm-deps, is that indicative of a problem with the library I am depending on, or something I am doing wrong?
no, I just want the final body @roman01la, I'd be curious to look at the source code on how that streaming is done. Sadly this part of the code at our company is pure js 😞
if you only need the body, then just add a listener that will fire once everything is fetched
Oh, maybe I am seeing the same thing @robert-stuttaford mentioned above
yes, if that should work, then it's not a streaming problem, but something else
xHR.readyState==4 && (xHR.status==200 || xHR.status==201)
only for Transfer-Encoding "chunked" is the xHR.response
empty. So I figured I needed to accumilate the chunks. But it could be something else, never done much streaming.try "load"
event, it should fire after response is fully received
@roman01la thanks for that tip, I think I will look more into the backend
xHR.addEventListener("load", function(){
console.log(xHR.response.byteLength);
});
returns 0 for chunk transfers. I'll not pollute the cljs channel with more js 🙂Hi all, let's say you are building an authenticated SPA, where you do not want to download the main app until after authentication. The simple way to do this would seem to be to just compile and serve separate login and main app payloads. While this works, you end up recompiling the common dependencies twice. Is there a way to avoid this, maybe using modules?
@thheller: would the approach be along the lines of setting the modules to load dynamically on the frontend, and then ensuring those modules resources are served from authenticated/authorized routes? Just trying to get a sense of the direction to research.
It is really hard to give generic instructions for :modules
since the “best solution” is usually specific to each individual app.
:modules
just let you split the code in specific ways so you can delay loading parts until later
Yeah, that's fair. I suppose in principle it should work as long as you can ensure that the private modules are served only on authenticated routes. Thanks for the response!
I don’t think it is useful to protect the JS files themselves. The code should ensure that the user is properly signed in and everything but that is part of your application code.
Delayed loading of the code should just be an optimization so that users only need to load code they are actually going to use
@theasp @robert-stuttaford have you guys tried lein clean
before rerunning the app?
Interestingly, I don't get the warning unless I clean first, but whatever it writes out doesn't work in either case
Lol, very odd. Mine doesn’t work unless I do a lein clean
have you looked into shadow-cljs? I hear it clears out a lot of the npm issues.
@robert-stuttaford I don’t think we support nested node_modules
installations
didn’t NPM stop doing that too at some point?
@anmonteiro they do it less but it still happens on version conflicts
@anmonteiro i’m not saying i want nested; i’m saying it seems cljs-deps is incorrectly producing a nested require relationship. the files on disk are flat, and my declared deps are flat. but it creates a nested dep call.
@levitanong i don’t ask for help unless i’ve tried everything first. it’s so clean you could fry your breakfast on it!
@robert-stuttaford run npm ls
and see if npm agrees that there are version conflicts. since npm 3 the tree will be flat unless two projects have conflicting subdependencies
i have no idea if cljs can handle that situation if it exists, but at least it will tell you what the source of the issue is
thanks @lee.justin.m - i actually manually made sure that the version is correct; and npm ls confirms it. only v3.7.4 of immutable shows up anywhere.
@thheller Yup, I don't see "undefined nameToPath"... Exception in thread "main" java.lang.ExceptionInInitializerError, compiling:(shadow/cljs/devtools/cli.clj:1:1)
🙂
@robert-stuttaford weird. i spent a ton of time reading the available documentation and blog posts and i still don’t understand what the npm-deps feature is actually doing. i should check out shadow-cljs but i’m having serious tool fatigue right now
i hear you @lee.justin.m 🙂 i’ve been spiking this draftjs thing and i’m already quite ready to set fire to everything.js
hey does anybody know how a cljsjs package could have disappeared? There was, apparently, a package called [cljsjs/react-dnd "2.0.2-0"]
but it is gone! It’s like left-pad all over again, except that apparently I’m the only one who noticed.
What would cause a lein cljsbuild auto
to suddenly switch from building a dev version to building a prod version after watching for a change and rebuilding?
in one line it says it's building from ["src" "env/dev/cljs"]
and in the next line it says ["src" "env/prod/cljs"]
@robert-stuttaford been getting similar issues. Often I’ve found a Lein clean fixes it. Sometimes need a second Lein clean as well
For a Clojure ClojureScript project, what’s the best way to structure them for shared code and easy cider development. Separate Lein projects or joint?
And if joint, how do you specify client does vs server does
Is there a way to specify Clojure only deps, so that the repl doesn’t bum out
you could isolate all cljs only deps to the cljsbuild profile
has anybody ever messed with javascript interop and run into either a _classCallCheck
error or a “can’t call a class as a function error”. they clearly have something to do with the babel transpilation from es6 classes but i cannot for the life of me figure out what is going on
@lee.justin.m maybe you are calling something as a function instead of creating a new isntance via new? (Thing)
vs (Thing.)
?