This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-24
Channels
- # aleph (3)
- # beginners (17)
- # boot (8)
- # cider (61)
- # cljdoc (13)
- # cljs-dev (2)
- # clojure (66)
- # clojure-boston (1)
- # clojure-italy (4)
- # clojure-nl (7)
- # clojure-russia (7)
- # clojure-spec (19)
- # clojure-uk (80)
- # clojurescript (73)
- # core-async (4)
- # cursive (6)
- # data-science (1)
- # datomic (33)
- # docs (13)
- # emacs (17)
- # figwheel-main (28)
- # fulcro (12)
- # graphql (1)
- # jobs (3)
- # leiningen (4)
- # luminus (1)
- # off-topic (1)
- # parinfer (1)
- # pedestal (46)
- # protorepl (3)
- # re-frame (30)
- # reagent (47)
- # reitit (10)
- # ring (1)
- # shadow-cljs (94)
- # spacemacs (12)
- # specter (16)
- # tools-deps (6)
- # uncomplicate (1)
- # vim (9)
i have a lot of data coming in as json, and being rendered as js objects, so i don't really want to add the overhead of converting too and from clj data structures. but the js data updates over time and needs to be re-rendered, and it would be nice to be able to treat it like an atom
@jjttjj there’s probably a reason not to, but the idea is kind of intriguing. if the data always comes from the server, then it seems quite interesting. if you are doing a lot of manipulation on the client side, then you may end up converting from clj->js (?). i implement ILookup
on object
(even though there are reasons that’s a bad idea) so that get-in
and destructuring work on js objects. that would pair nicely if you ended up doing that.
Hi I have a pretty simple web app made with re-frame/reagent/re-com and one annoying thing is that I'm using the secretary/accountant to deal with routing and I'd expect that when switching pages, it'd scroll to the top of the new page. Is there a trick to make sure that it sets the scroll to the top of the page when navigating?
You can call this: https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo in your handler.
Thanks. I found https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView to be more elegant ultimately
Yep, we had the same problem in our re-com demo page: https://re-com.day8.com.au
We fixed it by defining a scroll-to-top
fn and calling this when we navigate to new pages
Here's the simple code: https://github.com/Day8/re-com/blob/master/src/re_demo/utils.cljs#L110
And how it's used: https://github.com/Day8/re-com/blob/master/src/re_demo/core.cljs#L131
Having said all that, I just tested it and it no longer works. The code was written a long time ago and so, many moving parts have now moved
If you find out what's wrong with our code (or find a better way), drop me a note or create a PR 🙂
(defn ui-comp [p]
(let [ref (atom nil)]
(reagent/create-class
{:component-did-update
(fn [this]
(if-let [r @ref]
(.scrollIntoView r true)))
:reagent-render
(fn [p] (if p
[:div {:ref (fn [com] (reset! ref com))} p]
[:div]))})))
(defn ui []
(fn [] [ui-comp @(rf/subscribe [:page])]))
The above snippet worked beautifully. ui
is my outermost container.PS: The main problem is...it's not really switching pages, just re-rendering on the same one
if you have the element you can just call this on initial render and it should reset the page
hello guys
https://presumably.de/reagent-mysteries-part-1-vectors-and-sequences.html, in this post it shows how can you reagent table, i have tried this with making fields of rows as input, but when change the values of inputs i got re-render the row
i can't figure this out
my situation is: i have input field which has css hover property to change the radius, when i hover and change the input i got flashing the input
how can i fix this? or even what cause this problem?
what do you think guys?
Anyone know why when I do clojure -m cljs.main -re node
and execute (cljs.nodejs/require "package")
I get that the module cannot be found when it is in my node_modules
?
When I use cider-jack-in-cljs
it can find the package fine so I must be missing some command line argument
@dehli did you check the current directory? maybe you are just in the wrong directory? try (js/process.cwd)
@dehli I'm not sure where CLJS puts the output files. see if js/__filename
is defined?
well ideally you should use (require '["aws-sdk" :as x])
but that only works in shadow-cljs currently
The above works here with shadow, I use it in my project with plain install to package.json
So the above works, however when I do (require 'aws.core)
it fails since that namespace has (js/require "aws-sdk")
inside of it
hi guys
can i use this within clojurescript project https://felicegattuso.com/projects/datedropper/ ?
Does anyone know of an example that uses the D3 treemap? I can’t seem to find one on Google
I love how I can go back through the pages, change the definitions, and have it do something completely different in the end
Yeah… having the compiler with you in the browser is still something I find crazy cool 🙂
I think your site can be a great intro to people who are interested in Clojure / ClojureScript… especially since you can mess with the code
this is why I showed the SVG structures. Sure, I don’t mention sablano, but it’s just an intro
@quoll There is one place where it dumps the value of a function (and you see a lot of JavaScript). You might be able to avoid this by simply adding :def-emits-var true
to the options passed into the eval-str
call. https://clojurescript.org/reference/repl-options#def-emits-var
I was wondering there… I realize that it’s messy, but it also shows people that this really is generating code that does stuff!
do you know what the figwheel repl uses when printing a function? Because it just shows a short object string
I don’t think I want to change the :def-emits-var
, as there are a couple of screens which do a def
, and they wouldn’t see what was generated
I’m also trying to avoid configuring different behavior for each screen (there’s a little of that, such as the text vs. SVG output)
Hi, is anyone very familiar with cljsjs.react-modal? I am trying to make modals disappear when the user clicks the browser back button. The best info I have found is http://reactcommunity.org/react-modal/ , but I am currently unable to solve this. Any help appreciated.