Fork me on GitHub
#fulcro
<
2022-07-09
>
Toni Tuominen19:07:28

Any ideas why I might be getting this error? I get it when I am trying to route to a component.

react-dom.development.js:13232 Uncaught Error: Objects are not valid as a React child (found: object with keys {afn, meta, cljs$lang$protocol_mask$partition0$, cljs$lang$protocol_mask$partition1$}). If you meant to render a collection of children, use an array instead.
    at throwOnInvalidObjectType (react-dom.development.js:13232:15)
    at eval (react-dom.development.js:14134:7)
    at reconcileChildren (react-dom.development.js:16991:28)
    at finishClassComponent (react-dom.development.js:17512:5)
    at updateClassComponent (react-dom.development.js:17436:24)
    at beginWork (react-dom.development.js:19074:16)
    at HTMLUnknownElement.callCallback (react-dom.development.js:3946:14)
    at Object.invokeGuardedCallbackImpl (react-dom.development.js:3995:16)
    at invokeGuardedCallback (react-dom.development.js:4057:31)
    at beginWork$1 (react-dom.development.js:23965:7)
The component I am routing to is below. I commented out all the form related stuff to see if that was causing it.
(defsc EmployerForm [this props]
  {:ident         :employer/id
   :query         [:employer/id :employer/name :employer/net-multiplier #_fs/form-config-join]
   ;; :form-fields   #{:employer/name :employer/net-multiplier}
   :route-segment ["employers" :employer-id]
   :will-enter (fn [app {:keys [employer-id]}]
                 (let [id (keyword (apply str (rest employer-id)))]
                   (dr/route-immediate [:employer/id id])))}
  (p "Form")

Jakub Holý (HolyJak)21:07:16

It means that you are doing some thing like (<some html tag> <clojure data structure>) in some component. For example this would cause it: (dom/p "I will crash" props) . The code of your target component looks fine but it could be a different one. You can try https://github.com/holyjak/fulcro-troubleshooting, which will wrap each component with an ErrorBoundary, making it easier to see which one failed (or do the same yourself). The stacktraces are sadly often useless with React

Toni Tuominen08:07:53

It was an issue caused by my editor setup.... Thanks for the help, I'm sure your lib will come in handy in the future

🙏 1