This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-30
Channels
- # adventofcode (11)
- # beginners (155)
- # boot (627)
- # cider (64)
- # cljs-dev (110)
- # cljsrn (36)
- # clojure (290)
- # clojure-austin (21)
- # clojure-russia (2)
- # clojure-spec (2)
- # clojure-uk (21)
- # clojurescript (81)
- # code-reviews (2)
- # core-async (33)
- # cursive (6)
- # datomic (9)
- # emacs (1)
- # hoplon (472)
- # instaparse (1)
- # lein-figwheel (4)
- # luminus (9)
- # om (2)
- # protorepl (10)
- # re-frame (10)
- # reagent (48)
- # schema (2)
- # sql (5)
- # untangled (17)
- # vim (1)
- # yada (108)
New blog post on Reagent and the reloading workflow: http://presumably.de/reagent-2.html
Has anyone used Reagent with cljsjs/react-bootstrap
? I can't get controlled FormControl inputs work without cursor jumps :white_frowning_face:
yeah that's a common problem
you could try wrapping the component in something with component-local state
that sort of syncs with your state atom?
Thank you for the tip! I guess in the worst case I'll just use Reagent's input with Bootstrap CSS classes
yeah, just plain [:input]
works
I'd be curious how a simple r/state
based wrapper could work
I'll look into this
report back
@pesterhazy nice post!
thanks 🙂
@johanatan I am not aware of any straighforward way to get the path back out of it. However, I believe you can define your own set-get
function for a cursor ... and maybe you could add a print side-effect or something. https://github.com/reagent-project/reagent/blob/master/src/reagent/core.cljs#L280-L282
Yea, that was my conclusion as well (after reading the deprecated reagent-cursor (which I think is the same src in reagent itself now).
It's ok. I just took this as an opportunity to allow cursors to propagate further throughout my app (as I have a mix of cursors and prefixes being passed around)
@pesterhazy I guess I've managed to solve the jumping cursor by using local state and r/force-update
. And to sync the inner state of the component with the outer world I had to override :should-component-update
and :component-will-receive-props
@metametadata that looks great!
I think you need thread the on-change prop through to render
Otherwise it will always use the initial value, might lead to subtle bugs
I've commented about this in the docstring 🙂
Ah I did not see that
I agree it should be fixed
Is force-update required?
I thought updating state would have an immediate effect
because replace-state still rerenders asynchronously
Could you get around that by writing a react component directly?
Using React.createClass
Just wondering, nothing wrong with force-update of course
I guess so, but not 100% sure. Maybe it would make code a bit more readable because of no "async stuff"
here's the quote from the site: reagent.core/set-state and reagent.core/replace-state are now implemented using an reagent.core/atom, and are consequently async.
What??
Weird!
yeah, it's from v0.4.0
Well you can still access the actual component state by reaching into the js .-state
I was thinking that one could write a general purpose wrapper for this kind of application
right
A higher order component so to speak
De-asyncify
How is rect-bootstrap by the way?
Any good?
Well, I'm only trying it the sample project at the moment. I like that it's very close to raw Bootstrap, so I can google all the common solutions, add custom classes or reuse existing classes in Reagent components. It's also a bit smaller than Material UI wrappers. So far I don't like that inputs are broken and I can't override the <a> content of NavItems without hacks. Also no flexbox 🙂
Interesting
Hello, I have a question. I use goog.events to handle browser events. When I register a handler for the mouse_up event and change the state of an atom inside this handler, the components will not be rerendered immediately. In the repl I see that the value of the atom is already changed. Only when I do an interaction the view will be updated and the atom takes affect. Is it possible to force reagent to do a check of pending changes? In advance: reagent/flush do it not. Only reagent/force-update-all works, but the performance is horrible and not for production use. Any ideas?