         disable-load (atom (into #{'cljs.core
                                    'clojure.browser.repl
                                    'clojure.browser.net}
-                                 disable-load))]
+                                 disable-load))
+        closed-settings (select-keys closed-settings
+                                     [:before
+                                      :after
+                                      :state
+                                      :add-all?])]
     {'refresh
      (wrap (fn [repl-env analyzer-env [_ & opts] repl-opts]
-             (let [{:keys [source-dirs
-                           before
-                           after
-                           state
-                           add-all?] :as passed-settings} (apply hash-map opts)]
+             (let [passed-settings (apply hash-map opts)]
                (if-let [r @refresher]
                  (refresh* (merge {:refresher r
                                    :tracker tracker
+                                   :source-dirs source-dirs
                                    :disable-unload @disable-unload
                                    :disable-load @disable-load
                                    :repl-env repl-env

  (let [{:keys [::track/unload
                ::track/load]}
        (swap! tracker remove-disabled disable-unload disable-load)]
    (prn :rebuilding)
    ;; build.api does some expensive input checks
    ;; Once we're here, no checks are needed.
    (closure/build (apply build/inputs source-dirs)
                   repl-opts
                   env/*compiler*)
    (prn :requesting-reload load)
    (-refresh refresher {:repl-env repl-env
                         :analyzer-env analyzer-env
                         :repl-opts repl-opts
                         :before before
                         :after after
                         :state state
                         :unload-nss unload
                         :load-nss load}))
  (swap! tracker assoc ::track/load nil ::track/unload nil)
  (println :ok))


     :after - A symbol corresponding to a zero-arg client-side function that will be called after refreshing
     :state - A symbol corresponding to a client-side var that holds any state you would like to persisent between refreshes

   Everything but :source-dirs can be overridden in the repl by supplying them to 'refresh.

   The :state var will not be touched during unloading. However the namespace will
   be reloaded, so put it in a `defonce`. You must put your repl connection in
   the state var if you're using a browser repl!

   Refresh happens in the following order:
     1. :before is called
