Fork me on GitHub

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.


or did you mean that by screenreaders?


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 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.. 😅