This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-03
Channels
- # bangalore-clj (1)
- # beginners (160)
- # boot (174)
- # cider (57)
- # cljs-dev (16)
- # cljsrn (5)
- # clojure (144)
- # clojure-argentina (1)
- # clojure-austin (6)
- # clojure-finland (2)
- # clojure-france (4)
- # clojure-russia (185)
- # clojure-serbia (4)
- # clojure-spec (61)
- # clojure-uk (126)
- # clojurescript (212)
- # community-development (7)
- # core-async (2)
- # cursive (17)
- # datomic (210)
- # emacs (10)
- # euroclojure (2)
- # gsoc (23)
- # hoplon (86)
- # jobs (8)
- # lein-figwheel (9)
- # luminus (19)
- # lumo (12)
- # off-topic (4)
- # om (14)
- # om-next (6)
- # pedestal (38)
- # perun (11)
- # planck (35)
- # portland-or (2)
- # ring (1)
- # ring-swagger (28)
- # specter (6)
- # untangled (6)
- # yada (2)
I'm playing with hoplon/javelin/castra. Whenever I require [clj-http.client :as client] in my clojure file I get
java.lang.Exception: namespace 'clj-http.client' not found, compiling:(rsd/traxis.clj:1:1)
I have clj-http in dependencies in build.boot and clearly I have no idea what might be wrong(set-env!
:dependencies '[[adzerk/boot-cljs "1.7.228-1"]
[adzerk/boot-reload "0.5.0"]
[adzerk/boot-cljs-repl "0.3.3"]
[cheshire "5.7.0"]
[clj-http "2.3.0"]
[compojure "1.5.2"]
[hoplon/castra "3.0.0-alpha7"]
[hoplon/hoplon "6.0.0-alpha17"]
[http-kit "2.2.0"]
[org.clojure/clojure "1.8.0"]
[org.clojure/clojurescript "1.9.456"]
[org.clojure/tools.nrepl "0.2.12" :scope "test"]
[org.clojure/tools.reader "1.0.0-beta4"]
[pandeiro/boot-http "0.7.6"]
[ring "1.5.0"]
[ring/ring-defaults "0.2.1"]]
:resource-paths #{"assets" "src/clj" }
:source-paths #{"src/cljs" "src/hl/rsd"})
(require
'[adzerk.boot-cljs :refer [cljs]]
'[adzerk.boot-cljs-repl :refer [cljs-repl start-repl]]
'[adzerk.boot-reload :refer [reload]]
'[hoplon.boot-hoplon :refer [hoplon prerender]]
'[pandeiro.boot-http :refer [serve]])
(deftask dev
"Build rsd for local development."
[]
(comp
(serve
:port 8000
:handler 'rsd.handler/app
:reload true
:httpkit true)
(watch)
(speak)
(hoplon)
(reload)
(cljs)))
(deftask prod
"Build rsd for production deployment."
[]
(comp
(hoplon)
(cljs :optimizations :advanced)
(prerender)))
(deftask make-war
"Build a war for deployment"
[]
(comp (hoplon)
(cljs :optimizations :advanced)
(uber :as-jars true)
(web :serve 'rsd.handler/app)
(war)))
it's mostly from the hoplon-castra-template with some changed versions as it was not working right after generating
I should write probably whole story. When I reload the page second time I don't have this error
funny thing that it was working in the early morning, and I swear I did not change anything significant but still... it's not working
so this somehow tries to make a request to the endpoint, which tries to load the rsd.handler
ns
if that might help in any way I can show whatever file you want (with some minor changes)
if the rsd.handler
is loaded successfully on a clean repl startup - the issue is with however the boot-http/serve
task initializes the ns
I bet that's very simple but having something like this, how can I pass to click handler value of div r-id
and value of div r-status
(for-tpl [r rpc/rs=]
(div :class "event"
(button :click #(remove "here_id" "here_status") "X")
(div :class "r-id" id))
(div :class "r-status" status)))))
I wanted to just pass it when creating the button and divs but the size of the rpc/rs=
is changing and divs are not recreated. Only new text is set on them and that's it, so after first button click there is a mismatch
I simplified the example. Here it is with r
(for-tpl [r rpc/rs=]
(div :class "event"
(button :click #(remove "here_id" "here_status") "X")
(div :class "r-id" (text (:id r)))
(div :class "r-status" (text (:status r)))))))
what do you want to achieve? Do you want to do something with the actual DOM elements or with the contents of r
when the button is clicked?
I want to call remote system with appropriate values, then I'll get back new list in rpc/rs=
with one less element
I thought so, but then new list comes back and I have wrong value in button :click
handler as html elemnts are the same
then can you post the for-tpl
snippet that uses r
inside the :click
handler and produces the wrong value?
Will this be enough?
(defn remove-recording [id status]
(if (contains? #{"ongoing" "completed"} status)
(rpc/delete-single id)
(rpc/cancel-single id)))
(defn recordings-div []
(div :id "outer-recordings"
(h1 "Recordings:")
(div :id "recordings"
(for-tpl [recording rpc/recordings=]
(div :id "vrm-rec" :class "event"
(div :class "vrm-rec-title" (text (:title recording)))
(button :click #(remove-recording (:id @recording) (:status @recording)) (if (contains? #{"ongoing" "completed"} (:status @recording)) "Delete" "Cancel"))
(div :id (str "vrm-rec-id-" (:id @recording)) :class "vrm-rec-id" (text (:id recording)))
(div :id (str "vrm-rec-status-" (:id @recording)) :class "vrm-rec-status" (text (:status recording))))))))
Will that be ok so I don't have to repeat myself?
(let [id (cell= (:id recording))
status (cell= (:status recording))]
(div :class "vrm-rec-title" (text (:title recording)))
(button :click #(remove-recording id status) (if (contains? #{"ongoing" "completed"} (:status @recording)) "Delete" "Cancel"))
(let [id (cell= (:id recording))
status (cell= (:status recording))
button-label (cell= (if (contains? #{"ongoing" "completed"} status) "Delete" "Cancel"))
title (cell= (:title recording))]
(div :class "vrm-rec-title" title)
(button :click #(remove-recording @id @status) button-label)
(div :class "vrm-rec-id" id)
(div :class "vrm-rec-status" status))