This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-05
Channels
- # adventofcode (419)
- # aleph (8)
- # aws (6)
- # beginners (148)
- # boot (9)
- # cider (24)
- # cljs-dev (37)
- # cljsjs (8)
- # clojure (134)
- # clojure-android (6)
- # clojure-brasil (15)
- # clojure-dev (8)
- # clojure-dusseldorf (2)
- # clojure-greece (67)
- # clojure-italy (8)
- # clojure-japan (3)
- # clojure-russia (3)
- # clojure-spec (8)
- # clojure-uk (13)
- # clojurescript (54)
- # clojurex (6)
- # cursive (5)
- # data-science (12)
- # datomic (15)
- # defnpodcast (11)
- # emacs (25)
- # fulcro (95)
- # graphql (3)
- # lein-figwheel (1)
- # leiningen (27)
- # luminus (1)
- # lumo (6)
- # mount (2)
- # off-topic (112)
- # om (3)
- # onyx (24)
- # perun (3)
- # re-frame (20)
- # reagent (1)
- # reitit (2)
- # ring-swagger (13)
- # rum (10)
- # shadow-cljs (45)
- # spacemacs (24)
- # sql (2)
- # unrepl (78)
- # yada (1)
@pmn your lein ring server
will start a server on a port different than 3449 usually, have you tried putting clj.main/-main as your :ring-handler ? I think that would do the trick, since figwheel will watch the JS files for changes and also start its own frontend server at 3449... your backend server will start on 8001 it looks like, and that's the one you want to check out and work on once you use backend + figwheel (watch your backend server)
@sova thanks for the tips -- i tried switching over to clj.main/-main
as the :ring-handler, but getting the same results; it doesn't seem like it's actually starting it up. it sounds like this should be possible though, so it's probably just a config error on my part somewhere. thanks again!
:ring-handler hello_world.server/handler: If you want to embed a ring handler into the figwheel http-kit server; this is for simple ring servers, if this doesn't work for you just run your own server. Default: Off
(quoting the config options of figwheel page)
projectname.file/function
agame.main/handler
@pmn assuming your project is named "agame"
yeah; it seemed like it should start both, i'm guessing i've got something screwy. ah; i wonder if it's jetty vs. http-kit causing the problem
I dunno. Provided you're handling a hook to your main function it will probably just fire it up. Have you ever heard of Lein Trampoline? Yet another (older) alternative to launching apps
@nooga Just some more info: This is part of the UTF-16 spec. UTF-16 characters that fall above U+FFFF are encoded as surrogate pairs. That is, they take up 2 "characters."
However, each half of a surrogate pair means nothing in isolation. So it's unprintable.
Good day Channel! Is there anything to read on how npm_modules dir affects cljs compilation? I have an issue with a newbie reagent project, that compiles unexpectedly (for me) and incorrectly if npm_modules is present in the project root (compilation runs from there also).
https://google.github.io/closure-library/api/goog.dom.html <-- anyone have sample code for using setProperties from cljs ?
is there a robert.hooke for cljs?
Is there a way to get the repl-env in figwheel-sidecar "0.5.4-7" ? I want to connect within vim
Hi all! Question: what's the idiomatic way to invoke prevent defaults? a submit button redirects on click every time and I'd like to do some form validation before submission/change page
@qqq does this help? https://github.com/clojure/clojurescript/blob/master/src/main/cljs/clojure/browser/dom.cljs#L136
@sova, using react?
Rum, sir
have you tried (defn on-click [e] (.preventDefault e) (do-something-else))
?
basically just like regular React
N.b. I know nothing about Rum
There are many gaps in my knowledge of react and js, so thanks for that line of code...
::tinkering::
thank you that worked 😄 @pesterhazy
I am fairly new to clojure. I have been working on building this small app. The app is built with reageant and re-frame (hiccup). One of the component is a dropdown (select/options) that has A-Z. When I press a button called "Play" - I remove the selected letter from the dropdown. (I use javascript library for that) When I press a button called "Start over" I would like to refresh the (select/option back to A-Z). I have tried different ways and nothing works. Any ideas?
@melania.stewart you seem to be implying that you’re removing the select
option
child by direct DOM manipulation? This JS library you’re talking about?
@melania.stewart are you storing the A-Z list in your clojurescript code some place, or does it only exist in the HTML side of the world?
Everything still works fine and I can run and compile files, this is just a warning but would like to get rid of it. Thank you
(let [e (js/document.getElementByID "comboID] one of the calls in the body is (.remove e (.-selectedIndex e)) - This will remove the entry. Is this the best way to do this? (I have this question - but I am ok with this, because it does what I want).... But now I want to reset the component with the original list. The component looks as follow (defn combo-div [] [:div {:id "comboID"} [:select {:id "SelectID" [:option {:value "A"} "A"]....up to [:option {:value "Z" "Z"}]) I tried substituting the select component with a ratom and that didn't work. How would you do this? Sorry if I confuse you.
@melania.stewart isn’t that mixing paradigms? where reagent is using your data to create a dom, then you mutate the dom itself - I’d expect reagent to just undo the change next time it renders
since it is ignoring the dom contents and just translating shadow-dom into a new dom each time
usually if we want to remove an element from some :select
in reagent, we would programmatically filter the element out before handing it to reagent
How do you do the filtering, could you send me a sniplet? I think knowing the state of the DOM is the key. Are you saying that js routines affect the "real" DOM and not the "shadow" DOM, so when the "shadow" DOM commits into the "real" DOM they overwrite? Are we not suppose to use js methods directly then?
you can use js methods directly for things reagent doesn’t control (my app uses this for d3 for example)
but if the dom is being created by reagent via your data structure [:select ...]
the thing that actually works and doesn’t get undone by reagent is altering the data that you hand to it
a js viz lib that doesn’t use react
all I meant by that is you can use the js stuff directly, but you probably don’t want to do that for data you are asking reagent to render - the point of using a react wrapper is that react can speed up your render / re-render by managing the dom stuff for you
(one point at least)
I understand. I don't think I like to mix javascript with reagant, except when I can't find the right hooks. I am new to this.
So, how would I remove an option using reagent instead of using (.remove e (.-selectedIndex e)?
OK - you can use filter inside your reagent data (into [:select] (filter should-include? [[:option …] …]))
and should-include? can look at the option items, and could also look at something inside your atom
and if you look at an r/atom inside should-include? reagent is smart enough to re-render if the r/atom changes
another option is to put the vector with all the :option
items in an r/atom, and just put that in the :select