This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-11
Channels
- # admin-announcements (71)
- # beginners (8)
- # boot (109)
- # cbus (5)
- # cider (27)
- # cljsrn (77)
- # clojure (65)
- # clojure-austin (5)
- # clojure-berlin (1)
- # clojure-brasil (1)
- # clojure-dev (58)
- # clojure-japan (15)
- # clojure-russia (193)
- # clojure-seattle (3)
- # clojurescript (120)
- # cursive (19)
- # data-science (1)
- # datomic (10)
- # docs (1)
- # editors-rus (17)
- # emacs (2)
- # events (1)
- # funcool (7)
- # hoplon (2)
- # jobs (1)
- # jobs-rus (16)
- # ldnclj (7)
- # leiningen (3)
- # off-topic (12)
- # om (450)
- # onyx (122)
- # re-frame (69)
- # reagent (28)
- # yada (20)
:size
did pop up into my mind but it seems I misinterpreted your question. Yes, you can do a lot with :size
. If you haven't already, please read this important page: http://re-demo.s3-website-ap-southeast-2.amazonaws.com/#/layout
There's also a :size
button at the bottom of our h-box
demo page on the right where you can interactively play with it
yep, you know, I find myself always going to that page to remember what is the mapping between none
and `"g s b" š
and a question, if I have pure hmtl to display, to I have to convert it to hiccup for using it in :label
for instance?
because a div with dangerouslySetInnerHTML
does not play well with flexbox (as you noted in the demo š)
I have not played with dangerouslySetInnerHTML
myself so can't comment (where is it mentioned in the re-com demo?). I always convert any HTML to hiccup.
ok is not dangerously...
per se, but there a warning in Warning: Be All In
š
Ahh, ok. Then danger...
might still might be possible as long as the inserted HTML has the appropriate Flexbox styling
will try to convert because I have very strange behaviours with dang..
(I'll leave you four letters to play with š š)
Hi all, Iāve been digging into re-frame, itās really nice. I have a quick question - any examples or advice for chaining ajax calls? For example, in a photo gallery app, I have a :get-user
handler and a :get-photos
handler. :get-photos
can only happen after :get-user
. My current strategy is to have logic in the :get-user
handler and fire a dispatch to :get-photos
only when needed; does that sound reasonable?
Just curious if chaining ajax calls is a code smell? Maybe :get-photos and :get-user should be one atomic thing?
cool, thanks @roberto.
That's reasonable. The only difficulty I've had in loading data is that I like to display a loading animation, but when all of the data is loaded asyncronously it's hard to tell when the loader should be disabled.
yeah, makes sense. I have logic in the components so that if photos arenāt available, then the photo reagent component, for example, displays āloadingā. So I think from that perspective it should work ok. Although, Iām not a fan of the page loading bits and pieces at a time, so maybe Iāll do a few dispatch-syncs to start with. Thanks for the insights
What if you have two things that are loading at the same time? One may return before the other and put the app-db in a bad state? Or do you have :users-loading
and :posts-loading
for instance?
for example:
{:my-list-of-things {:loading? false :items []}
:my-other-list-of-things {:loading? false :items []}}
Iām not an expert, btw, this is just how Iāve dealt with use cases like this. Would love to know what ppl with more experience have done.
@nbdam what @jstew was referring too was when you want to track the loading progress of more than one item.
for example, you might have two components, that each load their own data, and you can show some message while they are loading...
if subs where references i would share the reference.. this way it seems more complicated...
@jstew just remember to clean it up in case of failure also and it should be fine for the most basic loading indicators...
@roberto: another way is to use alet and promesa - http://funcool.github.io/promesa/latest/#advanced-chaining - then you don't need to put anything in the db until you have everything you need. it's a bit harder to bend your brain around, but worth the effort
Before 0.5.0, I was able to print out console logs to the browser inside handler functions. After 0.5.0, my logs appeared to get swallowed and are not printed to the browser window. Has anyone else experience this issue? Any ideas how to get around it?
(defn mlog
"Logs entire vector of messages to browser console."
[& messages]
(.apply (.-log js/console) js/console (clj->js messages)))
@roberto: using the applicative and monad abstractions and their associated alet/mlet binding syntaxes makes working with promises much more straightforward
Iāll have to see it used in a real project. The impression I get from just reading the docs is that it feels very unnatural (in clojure).
and Iām very scared of Promises in the browser. My experience when something goes wrong has not been very pleasant. The stack traces are not very helpful.
@dd this is unrelated, but you should implement mlog as a macro, to preserve call site location in devtools console, also give this a try instead of doing clj->js: https://github.com/binaryage/cljs-devtools
but https://github.com/binaryage/cljs-devtools-sample/blob/master/src/devtools_sample/core.cljs#L4
https://github.com/binaryage/cljs-devtools-sample/blob/master/src/devtools_sample/boot.cljs#L37
look here for inspiration: https://github.com/darwin/plastic/tree/master/src/dev/plastic
also here are my logging macros: https://github.com/darwin/plastic/blob/master/src/common/plastic/logging.clj <- @dd
There is a library for debugging macros: https://github.com/noprompt/shodan