Fork me on GitHub
#reitit
<
2020-12-30
>
andrewboltachev00:12:42

How do I unleran Reitit router to follow links like # (they are just actions on a page for me)?

andrewboltachev00:12:09

Using even :ignore-anchor-click? (fn [router e el uri] true) didn't help — it's still following

andrewboltachev01:12:37

alright, this is 'cause of clicks to "#" causing popstate event

andrewboltachev01:12:07

i.e. it's this:

:listen-key (gevents/listen js/window goog.events.EventType.POPSTATE handler false)
event handler that fires

andrewboltachev02:12:47

:ignore-anchor-click?
     (fn [router e el uri]
       ;; Add additional check on top of the default checks\
       (and     
         (rfh/ignore-anchor-click? router e el uri)  
         (not (let [href (or (.-href el) "#")
                    result (clojure.string/includes? href "#")]
                (js/console.log "href" href)
                (when result    
                  (.preventDefault e)
                  (js/console.log "will prevent by href" href))
               result))))

andrewboltachev02:12:55

ended up doing like this

jacekschae12:12:51

Hi all in Reitit Channel. Wanted to let you know that http://LearnReitit.com course is ready. It’s around 9h of content and it’s still available in early access price. If video courses are something you enjoy check it out!

👍 4