From 9e5b7459f0df002b3f6c5773083897c3e1b2f8ff Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 18 Mar 2020 11:33:48 +0100 Subject: [PATCH] :fire: Remove unused code. --- frontend/src/uxbox/util/components.cljs | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/frontend/src/uxbox/util/components.cljs b/frontend/src/uxbox/util/components.cljs index 0e88340f7..c6d47c0c8 100644 --- a/frontend/src/uxbox/util/components.cljs +++ b/frontend/src/uxbox/util/components.cljs @@ -41,26 +41,3 @@ (mf/use-effect {:deps true :fn #(after-render state)}) (for [item (:current @state)] (children item))))) - -(defn wrap-catch - ([component error-component] (wrap-catch component error-component (constantly nil))) - ([component error-component on-error] - (let [ctor (fn [props] - (this-as this - (unchecked-set this "state" #js {}) - (.call js/React.Component this props))) - _ (goog/inherits ctor js/React.Component) - prot (unchecked-get ctor "prototype")] - (unchecked-set ctor "displayName" (str "Catch(" (unchecked-get component "displayName") ")")) - (unchecked-set ctor "getDerivedStateFromError" (fn [error] #js {:error error})) - (unchecked-set prot "componentDidCatch" (fn [e i] (on-error e i))) - (unchecked-set prot "render" - (fn [] - (this-as this - (let [state (unchecked-get this "state") - error (unchecked-get state "error")] - (if error - (mf/element error-component #js {:error error}) - (mf/element component #js {})))))) - - ctor)))