Fork me on GitHub
#fulcro
<
2022-01-27
>
njj14:01:26

I randomly get this error occasionally and I can’t seem to figure out why. Unfortunately it seems to resolve it self and then pop back up:

tony.kay16:01:17

You’re dereferencing something during render that is sometimes a function, sometimes not…where do you use @ or deref? Are you trying to hold callbacks in atoms or something like that?

njj16:01:33

hmm could be this

njj16:01:34

(defsc TabUnion [_ {:keys [which-tab] :as props}]
  {:query         (fn [] (map-vals get-query which-tab->tabui))
   :ident         (fn [] (generate-ident props))
   :initial-state (fn [_] (initial-state Blank {}))}
  (let [active-tab (@(which-tab->tabui which-tab) props)]
    (dom/div {:id        "tabunion_content"
              :className (str (name which-tab) "-tab")}
      active-tab)))

tony.kay16:01:22

I’d say that looks suspicious

👍 1
njj16:01:03

I wish I could find a way to reproduce it consistently

njj16:01:12

but maybe some kind of condition before deref

tony.kay16:01:27

why not just log what which-tab->tabui outputs on each frame

njj16:01:39

good call

tony.kay16:01:45

guessing that on an early frame it hasn’t initizlized fully or something and returns something you do not expect

tony.kay16:01:57

what happens if which-tab is nil?

tony.kay16:01:16

or an unsupported value

sheluchin16:01:16

rad-routing/route-to! is not a replacement for change-route-relative! when you have nested routers, correct?

tony.kay16:01:14

the former has additional RAD stuff built into it, and the latter is a low level call that allows you to not consider the full tree. Not sure what you’re looking for

tony.kay16:01:02

route-to computes the path to use based on the component and by reading the root query, and yes, it does a root-based route change as far as I remember

👍 1