Fork me on GitHub
#clojurescript
<
2016-07-02
>
john.carnell01:07:18

hey guys Anyone ever run into this problem. I am trying to create a new project with chestnut and lein and I keep getting this error: could not find artifact com.github.plexus:clj-jgit:jar:v0.8.9-preview in central (https://repo1.maven.org/maven2/) Could not find artifact com.github.plexus:clj-jgit:jar:v0.8.9-preview in clojars (https://clojars.org/repo/) I am not having network connectivity issues/.

kauko08:07:44

I have a general question about server-side rendered SPAs and URLs. I'm using Rum to render my application on the server, and I only have one route "/", and one "page", the root. Requesting the "/" route will render the root component on the server, and on the front the root will be mounted, and everything works nicely. Now, if I want to add URLs, how should I go about doing it? Since this is a SPA, resolving the URLs will need to be inside the components themselves (I think), meaning that the root component will always be mounted, but its children (and the children of those children) will depend on the requested URL. Is it silly to just give the current URL (or the relevant part of it) to the components that care about navigation? Is there a better way?

vinnyataide10:07:24

hello I would like to know why in some code there're bindings through :as if it's not used by the body of the function like:

(defn send-to-api [{:keys [api] :as remotes} cb]
  (send-query api (fn [{:keys [body status]}]
                    (when (= status 200)
                      (cb body)))))

kauko10:07:33

You're asking about the remotes?

kauko10:07:52

My guess is just so that the developer sees what the parameter is 🙂

kauko10:07:02

readability

vinnyataide10:07:13

@kauko that makes sense

kauko10:07:20

the code would work the same without the :as remotes part

vinnyataide10:07:53

about the rendering you need a lib to resolve the routing on the server before rendering

vinnyataide10:07:05

if you want server side rendering

vinnyataide10:07:43

if you dont just use secretary or any other lib and link the route to a var in the front end db

severed-infinity16:07:09

for some reason the variables remain unresolved, every thing except for the alert which works fine (for output testing purposes).

zentrope17:07:56

@severed-infinity: I’m not sure if it helps, but I do something like (set! (.-onload js/window) main) at the end of my main file.

zentrope17:07:01

And maybe try :optimizations :none? Oy. Kinda tough. I have “what I do” worked out, and just copy/paste from project to project. Not a good way to have broad knowledge of how these things load.

severed-infinity17:07:27

figured it out, needed to create an externs file and declare vars in it. though this seems make make the meta tag “^:export” useless.

zentrope17:07:45

Ah, so it was the :optimizations thing.

severed-infinity17:07:47

no, tried different optimization levels all with the same result. I’ve no idea the source of it the issue, if it is one at all; maybe I am missing something but cannot find any results online

jdonato18:07:25

is there a list anywhere of clojure things that don't work in clojurescript?

lockdown18:07:05

the repo has a document with the differences

Oliver George20:07:37

@severed-infinity: I think you need to use two script tags. One to load the JS. One to call the login() fn. Check the clojurescript QuickStart for a working example.

thheller20:07:49

@severed-infinity: you can't have js source inside a script tag that has a src

thheller20:07:34

move it into the empty script tag you have there

nathansmutz23:07:21

Adding [cljs.pprint :as pp] to my refer block, without actually using any of its functions, added over 100k to my app with advanced compilation. Is there something in that library defeating dead-code elimination, or should I look into some other setting?

nathansmutz23:07:23

(oops I meant the :require form in my ns)

mfikes23:07:02

@nathansmutz: No real priority has been given to reducing the code size associated with cljs.pprint, the expectation being that it isn’t frequently shipped in production apps. Oftentimes you want this in a REPL during dev and ClojureScript supports :repl-requires. I’ve written a non-normative post about that option: http://blog.fikesfarm.com/posts/2015-12-02-clojurescript-repl-auto-require.html

nathansmutz23:07:13

I had thought that it would be cut out entirely if nothing was referenced. I'd thought to use cl-format; but maybe I should take it a different direction.

mfikes23:07:33

Yeah, there are a few constructs that thwart DCE. Perhaps cljs.pprint has one or two in it.

nathansmutz23:07:28

I wondered if that was the case.

mfikes23:07:24

By simply requiring a namespace, any side effects that are in that namespace have to run, even if you don’t refer to any vars in that namespace. (One example might be that the namespace installs a defmethod.)