This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-10-20
Channels
- # admin-announcements (2)
- # beginners (38)
- # boot (12)
- # business (2)
- # cbus (2)
- # cider (8)
- # cljs-dev (32)
- # clojure (154)
- # clojure-brasil (43)
- # clojure-czech (3)
- # clojure-dev (5)
- # clojure-germany (1)
- # clojure-japan (2)
- # clojure-nl (2)
- # clojure-poland (9)
- # clojure-russia (29)
- # clojure-sg (12)
- # clojurescript (147)
- # clojurex (22)
- # community-development (2)
- # cursive (8)
- # events (3)
- # ldnclj (30)
- # ldnproclodo (1)
- # leiningen (1)
- # luminus (34)
- # off-topic (6)
- # om (255)
- # re-frame (1)
- # reagent (22)
- # rum (2)
- # yada (1)
@eggsyntax: We’re trying to display an “error component” if the callback fails and we’re not quite sure the idiomatic place to do this.
When the page loads, we call render-component
with an accounts-component
. In the accounts-component
, we call our AJAX function before we return our function component. If the AJAX call succeeds, we update the state of our global atom and the accounts-component
renders appropriately. If the AJAX call fails, nothing renders and that area of the page is blank.
I haven't tried to do anything quite like that, but what you're saying sounds sensible. Sounds like you need to either use two values (eg accounts-callback-returned
and account
) or use a special value for a failed callback (eg account
could be nil for "hasn't returned yet", false for "failed", and the returned account otherwise). And then do something in your top-level component like (when-not (nil? account) (if account [accounts-component] [failure-component]))
.
@statonjr sounds reasonable to me. A slight alternative is to do the ajax call in whatever page init
-like function you have above when the render-component
function is called. As an aside render-component
is being deprecated in favor of render
.
@gabe never heard of Radium, but looks great! Definitely curious to try this out :)
@gadfly361: from #C06DT2YSY
@gadfly361: Thanks for the reminder about the deprecated function.
@statonjr: or alternately, it also seems reasonable to me to have accounts-component
itself return different content depending on what the AJAX call returned.
Conceptually, does it feel more like two distinct components or one component that might look a couple of different ways? Seems like a matter of taste to me.
Two distinct components for sure. Moreover, we may want to have the error-component
in a separate namespace so we can reuse the component across contexts.
I want googlebot to love my Reagent webapp. When I enter in a URL with hash, a la Secretary, Google ignores everything after the hash.
They claim to have fixed this. http://googlewebmastercentral.blogspot.com/2015/10/deprecating-our-ajax-crawling-scheme.html
Do I need to add an exclamation point, to make a hashbang? Or use Accountant, https://github.com/venantius/accountant?
Specifically, if I try to add a URL in Google's webmaster tools like
, I get "The URL you entered is invalid. Please make sure you have typed it correctly and that it uses the proper syntax and try again."
Google used to say we should use https:
Does anyone have experience making a Reagent SPA - especially routing - play nicely with search engines?