This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-14
Channels
- # beginners (19)
- # boot (28)
- # cider (1)
- # cljs-dev (12)
- # cljsrn (1)
- # clojure (246)
- # clojure-belgium (4)
- # clojure-berlin (1)
- # clojure-france (4)
- # clojure-italy (7)
- # clojure-russia (11)
- # clojure-serbia (3)
- # clojure-spec (5)
- # clojurescript (106)
- # cursive (4)
- # datomic (7)
- # emacs (1)
- # jobs (6)
- # leiningen (3)
- # luminus (1)
- # lumo (11)
- # off-topic (1)
- # om (7)
- # onyx (1)
- # pedestal (6)
- # re-frame (16)
- # reagent (4)
- # rum (3)
- # spacemacs (1)
- # unrepl (1)
- # untangled (5)
- # vim (1)
Is it possible to have react not rerender a component when it lands on the client after rendering serverside? I have a HTML5 video background that is a few levels deep from the page render and I can't seem to stop it from rerendering the video and restarting it. Not quite sure how to do it. I've tried the should component update. For reference I am using Rum. But I have struggled to find information anywhere on teh web regarding this specific use case.
I'm struggling with deps.cljs as part of trying to get my app running on the latest clojurescript release
Where should deps.cljs live? Where should any associated xxx.js files live? Where should associated extern xxx.js files live?
Curently my deps.cljs is at src/cljs/deps.cljs
And I have resources/libs/xxx.js and resources/externs/xxx.js
My deps.cljs refered to paths like (below) which previously worked but perhaps path relative to resources isn't right. My experiments aren't helping yet.
:foreign-libs
[{:file "lib/ui-libs.js"
Starting to wonder if it's a windows compatibility issue.
fair point. i can remove that variable easily enough.
Time for a lein new mies
experiment
I retract my wild accusations about windows compatibility. It can work.
I couldn't tell you why but it seems to fail once I add a :preloads compiler option.
And only when the preload requires one of those foreign libs. Huh.
is there a way to tell Chrome: for the profile named cljs-dev ALWAYS DISABLE CACHE even when debug window / inspector is closed just ALWAYS DISABLE CACHE
@qqq when you serve your CLJS over HTTP you can add a few headers that disable any kind of caching
Does anyone have suggestions on how to develop a better understanding of macros in Clojurescript? I have a couple I’ve been working on today that work in Clojure but not CLJS. One problem in particular seemed to be calling a macro from a macro (nesting). In another case I’m completely lost: in a CLJS repl I call macroexpand on a macro I wrote (works in CLJ) and it’s identical to the expansion I’m looking for, but it doesn’t work 😕
@alex-dixon no suggestions on the understanding part but if you have a specific problem/example I can maybe help
(macroexpand
'(defsub :task-entry
[[?e :entry/title ?v]]
=>
{:db/id ?e :entry/title ?v}))
=>
(def
task-entry-sub___impl
{:ns-name 'precept.todomvc.rules,
:lhs '[{:type :precept.spec.sub/request,
:constraints [(= ?e (:e this)) (= :task-entry (:v this))]}
{:type :entry/title, :constraints [(= ?e (:e this)) (= ?v (:v this))]}],
:rhs '(do (precept.util/insert! [?e :precept.spec.sub/response {:db/id ?e, :entry/title ?v}])),
:props {:group :report},
:name "precept.todomvc.rules/task-entry-sub___impl"})
(macroexpand
'(def-tuple-rule subs-task-entry
{:group :report}
[[?e ::sub/request :task-entry]]
[[?eid :entry/title ?v]]
=>
(precept.util/insert! [?e ::sub/response {:db/id ?eid :entry/title ?v}])))
=>
(def
subs-task-entry
{:ns-name 'precept.todomvc.rules,
:lhs '[{:type :precept.spec.sub/request,
:constraints [(= ?e (:e this)) (= :task-entry (:v this))]}
{:type :entry/title, :constraints [(= ?eid (:e this)) (= ?v (:v this))]}],
:rhs '(do (precept.util/insert! [?e :precept.spec.sub/response {:db/id ?eid, :entry/title ?v}])),
:props {:group :report},
:name "precept.todomvc.rules/subs-task-entry"})
@thheller Thanks 🙂 The first one is the new macro and the second is the working version
So I think these are identical and yet the first isn’t working. So one question I have is whether macroexpand in a CLJS repl is a reliable source of information
I’m also looking for a development feedback loop for writing macros in CLJS that is fast as the one in Clojure (where I can pretty much just work at the REPL). I’m not able to get reliable results using the setup I have without running figwheel/cljsbuild. Not sure if there’s a better alternative
(defn drop-zone []
(let [drag-over? (ratom false)]
(fn []
[:div {:id "drop_zone"
:style {:border "3px dotted #888"
:width "100%"
:height "100%"
:background (if @drag-over?
"#ccc"
"#eee")}
:on-drag-enter (fn [e] (reset! drag-over? true))
:on-drag-over (fn [e] (reset! drag-over? true))
:on-drag-leave (fn [e] (reset! drag-over? false))
:on-drop (fn [e]
(assert false)
(. js/window alert "Calling preventDefault")
(.preventDefault e)
(. js/console log "file dropped"))}
[:h4 "1. Drag Problem Here"]])))
In this code, the drag-over/leave works fine. When I drag a file over it, it changes color.
However, when I drop the file, the assert false, alert, and preventDefault are not triggered.
Insteac, the browser displays the dropped file.
How do I debug this?@alex-dixon looks ok, what kind of errors do you see? which part doesn't work?
not sure what kind of feedback look you are looking for, I develop macros in a CLJ REPL only
It does
I’m not seeing errors on this one. The functionality just isn’t the same is the only way I can tell currently
Ok. Thanks for your help. Think I’m too tired to think about it much more right now unfortunately
@john: you're goingto love this; the 'correct solution' is to add (.preventDefault e) on DRAG-OVER also. I have n idea why, sinc'e it's a on-DROP action ; but apparently we need to prevent Default on on-DRAG-OVER too
does anyone know if node/webpack have a default to detect whether the script is running in the browser or node? something along the lines of process.env.NODE_ENV
?
how are native React classes usually used as props to other native React classes that have been adapted with adapt-react-class ??
I am currently using soda-ash ( a reagent adaptation of semantic-ui react). While dealing with sidebar there is 'as' prop that needs a string/function ( a react component). here's what i am doing [sa/SidebarPushable {:as (r/reactify-component [sa/Segment])} [sa/Sidebar {:as (r/reactify-component [sa/Menu]) :vertical true :inverted true :animation "overlay"} [sa/MenuItem {:name "Strategies"} [sa/Icon {:name "puzzle"}]]]]
@binora, usually #(r/as-element [my-component])
does the job
@pesterhazy thanks for the quick response. have tried it. doesnt work. had to hack it this way {:as (aget js/semanticUIReact "Segment")}.
that's probably because of some special magic in the component that looks for direct children
reagent probably introduces an intermediary element
I just wrote a thing for all the node
/ webpack
folks out there, looking for any kind of feedback. https://groups.google.com/forum/?fromgroups=#!topic/clojurescript/AGXku7Ous0Y
@thheller that is great, I will check the gory details as well 😀 do you use shadow-build
for compiling?
Nvm the silly question 😀 of course you do Iam checking the sample
@richiardiandrea yes of course, I know nothing else. 😉
it is basically what you suggested in the webpack thread, it drops the google closure compiler entirely.
Yes and that is exactly what I was looking for 😀😀 Thanks I will surely give it a go
Not only that, we basically use js deps only in some project so this is really a good solution here
do you know any other common JS tools people use? I now have webpack
and create-react-app
examples
I am not a js dev at all and learning things, but I happened to need very JS friendly workflows. Another big issue for that is debug. A typical JS dev expects node --inspect
to work smoothly. Also we target node not browser.
I see a lot of people using flow
Plain node and at the moment experimenting with TypeScript too. It is bleeding edge for Js language features
I should have said "features"
We are investigating TypeScript because of the solid tooling
I could not defend that against cljs unfortunately 😀 I am so so sad that the REPL is so underestimated in JS land
Thanks to your experiment I will be able to work on a parallel POC that might overthrow TypeScript 😀
@richiardiandrea didn't test that before but node --inspect
seems to work flawlessly. even has source maps.
Well I think dirac
helps with it
I still need to try it out (with node) maybe @darwin worked some magic in his plugin 😀
Ok I didn't even know it was themable
Ah ok..so we should pr chrome devtools
but I noticed that devtools are missing syntax highligting with node --inspect
recently
but before reporting as a bug, one should try it with nightly first: https://github.com/binaryage/dirac/blob/master/docs/node.md#nodejs-version
@darwin it also seems to be missing support for devtoolsFormatters
.. at least I can't figure how to register on the node side (since there is no window
)
https://github.com/binaryage/cljs-devtools/blob/master/src/lib/devtools/context.cljs#L5
":nodejs target with :none optimizations requires a :main entry": https://github.com/clojure/clojurescript/commit/197ff2e7c3f96b365e31cf4c1a4af39bdd60fc88
@peeja I don’t know if it used to
@peeja which version are you upgrading from?
prior to 1.9.456?
what prompted me to add that check was that it didn’t work for me
and it was really hard to figure out why
and I’m not properly a CLJS beginner, so I thought it would be helpful for other people
I'll wait until the cljs-lambda
maintainer updates the template. I only upgraded for the #:namespace-prefix{}
syntax anyhow. 🙂
well, if it happened to work before, I think it would be helpful to bring back that behavior
and track down where it started to break