Deprecate component-path in core ns

This commit is contained in:
Juho Teperi 2019-12-17 15:40:51 +02:00
parent ad3b6af57e
commit 106e5d86ca
2 changed files with 11 additions and 9 deletions

View File

@ -83,8 +83,8 @@
(dom/unmount-component-at-node container)) (dom/unmount-component-at-node container))
;; For backward compatibility ;; For backward compatibility
(def ^{:deprecated true} as-component as-element) (def ^{:deprecated "0.10.0"} as-component as-element)
(def ^{:deprecated true} render-component render) (def ^{:deprecated "0.10.0"} render-component render)
(defn force-update-all (defn force-update-all
"Force re-rendering of all mounted Reagent components. This is "Force re-rendering of all mounted Reagent components. This is
@ -390,8 +390,9 @@
(util/make-partial-fn f args)) (util/make-partial-fn f args))
(defn component-path (defn component-path
;; Try to return the path of component c as a string. "Try to return the path of component c as a string.
;; Maybe useful for debugging and error reporting, but may break Maybe useful for debugging and error reporting, but may break
;; with future versions of React (and return nil). with future versions of React (and return nil)."
{:deprecated "0.10.0"}
[c] [c]
(comp/component-path c)) (comp/component-path c))

View File

@ -5,6 +5,7 @@
[reagent.debug :as debug :refer-macros [dev?]] [reagent.debug :as debug :refer-macros [dev?]]
[reagent.core :as r] [reagent.core :as r]
[reagent.dom.server :as server] [reagent.dom.server :as server]
[reagent.impl.component :as comp]
[reagenttest.utils :as u :refer [with-mounted-component]] [reagenttest.utils :as u :refer [with-mounted-component]]
[clojure.string :as string] [clojure.string :as string]
[goog.string :as gstr] [goog.string :as gstr]
@ -662,7 +663,7 @@
tc (r/create-class {:display-name "atestcomponent" tc (r/create-class {:display-name "atestcomponent"
:render (fn [] :render (fn []
(let [c (r/current-component)] (let [c (r/current-component)]
(reset! a (r/component-path c)) (reset! a (comp/component-path c))
[:div]))})] [:div]))})]
(with-mounted-component [tc] (with-mounted-component [tc]
(fn [c] (fn [c]