This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-07
Channels
- # aleph (11)
- # aws (8)
- # bangalore-clj (4)
- # beginners (32)
- # boot (48)
- # cider (2)
- # cljs-dev (57)
- # cljsrn (4)
- # clojars (22)
- # clojure (67)
- # clojure-argentina (2)
- # clojure-austin (9)
- # clojure-berlin (1)
- # clojure-brasil (15)
- # clojure-france (1)
- # clojure-italy (10)
- # clojure-russia (23)
- # clojure-spec (6)
- # clojure-uk (48)
- # clojurescript (143)
- # cursive (15)
- # datomic (30)
- # emacs (18)
- # hoplon (26)
- # instaparse (1)
- # leiningen (1)
- # om (21)
- # om-next (9)
- # parinfer (3)
- # pedestal (3)
- # planck (2)
- # re-frame (53)
- # reagent (4)
- # ring (5)
- # spacemacs (1)
- # specter (10)
- # sql (16)
- # untangled (19)
- # vim (11)
- # yada (2)
Should pushy not catch clicks on href and prevent the page reloading, or should I be doing that myself somehow?
@danielstockton Don't use anchorlinks, just use <button> or smth and with :onClick (fn [_] ...) you can add to pushy history and do some state changes in om. That's how I do it, but could be better ways. Then you have the problem if the user reloads the page, where you could transact the state you want to see in componentWillMount.
From the pushy docs: "By default pushy will dispatch on all relative URLs and absolute URLs that match the window's origin. This means that all external links will be bypassed."
This doesn't seem to be happening though
If you use html anchor tag <a> (or om.dom/a) then that behaviour will always be evaluated first in the browser. you could do (dom/a #js {:href "#" :onClick #(pushy/push-state ...)) (dont have the pushy functions on top of my head).
I guess calling preventDefault doesn't matter, i'll try your workaround
I'm trying to use compassus so i'll use something like (compassus/set-route! app :about)
in the onClick
yes sounds like the way to go. But in general, working so much with javascript, I recommend avoiding anchorlinks <a>, I just add in css the hover style then nobody notices a difference.
you could argue its less accessible that way, maybe
not sure how screenreaders handle onclicks, for example
im being quite pernickety, but would rather get these things right from the beginning
yes, not sure with the screenreaders, I've never done mobile development so far but the websites I've built work fine in iphone and samsung. When I see some react addons giving the option :onTap :onTouch, I have no idea what to use it for.
I meant programs that read things aloud for blind people but it can probably be fixed by setting other attributes properly, I doubt they use the href. Also, really not a concern for what I'm doing right now but I'm just trying to establish the best practice.
ahh ok, yes. With the emergence of SPA many technologies have had to change. Somehow the google-spiders can recursively open a react website and document the hrefs.
@hlolli It was actually another problem entirely. I was missing an om/util function, which led me to update om.next and cljs. Now it works perfectly fine with href...
Is it a bad practice to pass full query to Datomic back-end including back-references (eg :some-entity/_backref) ? I tried to only pass the key, but it seems it’s only possible to set :query-root on join queries rather than simple keys, so I though I’d send the whole thing.
@danielstockton @hlolli using anything other than anchors for links in single page app breaks browser behavior of ctrl+click on a link please don’t do that
Sorry had to say this, I absolutely hate single page apps that break this.. 😅