day8 / re-frame-10x

A debugging dashboard for re-frame. X-ray vision as tooling.
MIT License
634 stars 68 forks source link

Recent changes to Reagent impact re-frame-10x #269

Closed mike-thompson-day8 closed 3 years ago

mike-thompson-day8 commented 4 years ago

Reported by @andre on slack ....

In re-frame-10x for tracing components rendering static-fns from reagent had been monkeypatched, but in latest reagent alpha releases it was removed https://github.com/reagent-project/reagent/commit/28c9b8921df58f0cca29bf2ac1e1f4b1e8c90bc4 , are there any plans to integrate tracing in reagent ?

Background: see this code which does the monkey patching.

We probably need to ask for better APIs in the new alpha version. See also https://github.com/day8/re-frame-10x/issues/115

n2o commented 4 years ago

This problem now throws Errors every time a namespace is recompiled.

λ npx shadow-cljs watch app                                                                                                                                                                                                                                                                                     10:16:51
shadow-cljs - config: [...]/shadow-cljs.edn
shadow-cljs - starting via "clojure"
NPM dependency "react" has installed version "^16.13.1"
"16.13.0" was required by jar:file:/Users/n2o/.m2/repository/reagent/reagent/1.0.0-alpha2/reagent-1.0.0-alpha2.jar!/deps.cljs
NPM dependency "react-dom" has installed version "^16.13.1"
"16.13.0" was required by jar:file:/Users/n2o/.m2/repository/reagent/reagent/1.0.0-alpha2/reagent-1.0.0-alpha2.jar!/deps.cljs
NPM dependency "highlight.js" has installed version "9.18.3"
"9.18.1" was required by jar:file:/Users/n2o/.m2/repository/day8/re-frame/re-frame-10x/0.7.0/re-frame-10x-0.7.0.jar!/deps.cljs
shadow-cljs - HTTP server available at http://localhost:8700
shadow-cljs - server version: 2.10.21 running at http://localhost:9630
shadow-cljs - nREPL server started on port 8777
shadow-cljs - watching build :app
[:app] Configuring build.
[:app] Compiling ...
[:app] Build completed. (662 files, 1 compiled, 3 warnings, 7,55s)

------ WARNING #1 - :fn-arity --------------------------------------------------
 Resource: day8/re_frame_10x.cljs:34:28
--------------------------------------------------------------------------------
  31 |                                        {})
  32 |                           :operation (operation-name c)}
  33 |                          (if util/*non-reactive*
  34 |                            (reagent.impl.component/do-render c)
----------------------------------^---------------------------------------------
 Wrong number of args (1) passed to reagent.impl.component/do-render
--------------------------------------------------------------------------------
  35 |                            (let [rat        (gob/get c "cljsRatom")
  36 |                                  _          (batch/mark-rendered c)
  37 |                                  res        (if (nil? rat)
  38 |                                               (ratom/run-in-reaction #(reagent.impl.component/do-render c) c "cljsRatom"
--------------------------------------------------------------------------------

------ WARNING #2 - :fn-arity --------------------------------------------------
 Resource: day8/re_frame_10x.cljs:38:71
--------------------------------------------------------------------------------
  35 |                            (let [rat        (gob/get c "cljsRatom")
  36 |                                  _          (batch/mark-rendered c)
  37 |                                  res        (if (nil? rat)
  38 |                                               (ratom/run-in-reaction #(reagent.impl.component/do-render c) c "cljsRatom"
-----------------------------------------------------------------------------^--
 Wrong number of args (1) passed to reagent.impl.component/do-render
--------------------------------------------------------------------------------
  39 |                                                                      batch/queue-render reagent.impl.component/rat-opts)
  40 |                                               (._run rat false))
  41 |                                  cljs-ratom (gob/get c "cljsRatom")] ;; actually a reaction
  42 |                              (trace/merge-trace!
--------------------------------------------------------------------------------

------ WARNING #3 - :undeclared-var --------------------------------------------
 Resource: day8/re_frame_10x.cljs:68:11
--------------------------------------------------------------------------------
  65 |                                    :operation (last (str/split name #" > "))}
  66 |                                   (real-renderer c)))))
  67 | 
  68 |     (set! reagent.impl.component/static-fns static-fns)
-----------------^--------------------------------------------------------------
 Use of undeclared Var reagent.impl.component/static-fns
--------------------------------------------------------------------------------
  69 | 
  70 |     (set! reagent.impl.component/custom-wrapper
  71 |           (fn [key f]
  72 |             (case key
--------------------------------------------------------------------------------
superstructor commented 3 years ago

reagent 1.0.0 support fixed in re-frame-10x 1.0.0.

115 covers improving the integration further via a better API so I'm closing this.