 (defn- on-change-page-state
   "Render the page on every state change."
   [_kwd _the-atom _old-state new-state]
-  (rum/request-render
-    (rum/mount (IndexApp new-state) app-container-el)))
+  (rum/mount (IndexApp new-state) app-container-el))
 
 (add-watch page-state :main on-change-page-state)
 

(ns tourneybot-client.core
  (:require
    cljsjs.marked
    cljsjs.moment
    [clojure.string :refer [blank? lower-case]]
    [goog.functions :refer [once]]
    [tourneybot.data :refer [scheduled-status in-progress-status finished-status game-statuses
                             games->results
                             ensure-tournament-state
                             game-finished?]]
    [tourneybot.util :refer [atom-logger by-id js-log log fetch-ajax-text
                             fetch-json-as-cljs tourney-bot-url
                             game->date]]
    [rum.core :as rum]))

;;------------------------------------------------------------------------------
;; Constants

(def sort-on-record "SORT-BY-RECORD")
(def sort-on-values #{sort-on-name sort-on-record})

(def in-dev-mode? (not= -1 (.indexOf js/document.location.href "devmode")))

(def info-page-url "info.md")
(def tournament-state-url
  (if in-dev-mode?
    "tournament.json"
    "api/latest.php"))

;; TODO: allow this to be overriden with a query param
(def refresh-rate-ms 5000)

;;------------------------------------------------------------------------------
;; Page State Atom
