       [:div.see-alsos
        [:span.see-also-label "see also:"]
        [:ul
-        (for [{:keys [ns name href] :as sa} see-alsos]
-          [:li
-           [:a {:href href :class "var-link"}
-            [:span.namespace ns]
-            "/"
-            [:span.name name]]])]
+        (->> see-alsos
+             (map-indexed
+               (fn [i {:keys [ns name] :as sa}]
+                 ^{:key i}
+                 [:li
+                  [:a {:href "#" :class "var-link"}
+                   [:span.namespace ns]
+                   "/"
+                   [:span.name name]]])))]
        (when (> num-left 0)
          [:span.remaining-label
           (str "+ " num-left " more")])])))

            [clojuredocs.anim :as anim]
            [clojure.string :as str]
            [cljs.reader :as reader]
            [sablono.core :as sab :refer-macros [html]]
            [clojuredocs.util :as util]
            [clojuredocs.metrics :as metrics])
  (:require-macros [cljs.core.async.macros :refer [go go-loop]]))


(defn init [$root]
  (let [prev-query (util/location-hash)
        !state (rea/atom {:ac-text (when-not (re-find #"^example[_-]" prev-query)
                                     prev-query)})
        bus (ops/kit
              !state
              {}
              {::ac-text-changed (fn [state ac-text]
                                   (assoc state :ac-text ac-text))

               ::ac-text-throttled
               (fn [state ac-text]
                 (let [ch (chan)]
                   (go
                     (put! ch (merge state {:search-loading? true}))
                     (if (empty? ac-text)
                       (do
                         (put! ch (merge state {:results-empty? false
                                                :ac-results []
                                                :search-loading? false}))
                         (set-location-hash! ""))
                       (do
                         (put! ch (merge state {:search-loading? true}))
                         (let [ac-response (<! (ajax-chan {:method :get
                                                           :path (str "/ac-search?query=" (util/url-encode ac-text))
                                                           :data-type :edn}))
                               data (-> ac-response :res :body)]
                           (when (:success ac-response)
                             (metrics/track-search ac-text)
                             (put! ch
                               (fn [state]
                                 (merge
                                   state
                                   {:highlighted-index 0
                                    :results-empty? (and (empty? data) (not (empty? ac-text)))
                                    :ac-results data
                                    :search-loading? false})))))))
                     (close! ch))
                   ch))

               ::move-highlight (fn [state dir]

                                  (assoc state
                                    :highlighted-index
                                    (min
                                      (dec (count (:ac-results state)))
                                      (max 0 (+ (:highlighted-index state) dir)))))

               ::cancel-search (fn [state]
                                 (dissoc state :search-loading? :ac-results :ac-text :results-empty?))

               ::ac-select (fn [state res]
                             (util/navigate-to (util/var-path
                                                 (:ns res)
                                                 (:name res))))})]

    (when-not (empty? (sel :.search-widget))
      (swap! !state assoc :search-focused? true))

    #_(go-loop []
        (when-let [res (<! action-ch)]
          (metrics/track-search-choose (:ac-text @!state) (:href res))
          (set-location-hash! (:ac-text @!state))
          (util/navigate-to (:href res))
          (recur)))

    #_(wire-search text-chan !state)

    #_(dommy/listen! js/window :hashchange
        (fn [_]
          (let [loc-hash (util/location-hash)]
            (when-not (re-find #"^example[_-]" loc-hash)
              (swap! !state assoc :ac-text loc-hash)
              (put! text-chan loc-hash)))))

    #_(when (and (not (empty? prev-query))
                 (not (re-find #"^example[_-]" prev-query)))
        (swap! !state assoc :search-focused? true)
        (put! text-chan prev-query))

    (doseq [$el (sel :.search-widget)]
      (rea/render-component
        [$quick-lookup-widget !state bus]
        $el))

    (doseq [$el (sel :.quick-search-widget)]
      (rea/render-component
        [$quick-search-widget !state bus]
        $el))

    (doseq [$el (sel :.ac-results-widget)]
      (rea/render-component
        [$ac-results-widget !state bus]
        $el))

    (doseq [$el (sel :.search-feedback-widget)]
      (rea/render-component
        [$search-feedback @!state bus]
        $el))))
