This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-04-20
Channels
- # aws (1)
- # beginners (14)
- # boot (30)
- # cider (6)
- # clara (9)
- # cljsjs (3)
- # cljsrn (22)
- # clojure (247)
- # clojure-dusseldorf (75)
- # clojure-france (38)
- # clojure-italy (6)
- # clojure-japan (8)
- # clojure-nl (3)
- # clojure-russia (16)
- # clojure-serbia (4)
- # clojure-spec (1)
- # clojure-uk (53)
- # clojurescript (168)
- # consulting (3)
- # copenhagen-clojurians (1)
- # core-async (7)
- # css (1)
- # datascript (3)
- # datomic (8)
- # dirac (22)
- # events (1)
- # hoplon (2)
- # jobs (1)
- # jobs-discuss (2)
- # leiningen (4)
- # lumo (138)
- # mount (13)
- # nyc (1)
- # off-topic (24)
- # om (34)
- # onyx (15)
- # pedestal (30)
- # re-frame (9)
- # reagent (23)
- # ring (1)
- # ring-swagger (24)
- # rum (6)
- # spacemacs (6)
- # specter (51)
- # uncomplicate (14)
- # unrepl (1)
- # untangled (17)
- # yada (12)
is there a way to prevent exceptions from breaking the React tree structure? E.g. when I make a (javascript) syntax error, say (.useSomeUnknownMethod obj)
in a component definition this forces me to refresh the app. I would like to fix it and not having to refresh my browser
I’m guessing this could be done by wrapping the render method with a try/catch (but I would have to do monkey patch to do this globally, without introducing new mixins)
@tonsky So I’m editting my rendered application with figwheel and I introduce a runtime error in my view e.g. (.getasdfa data)
. I’m getting an error as expected:
edit.cljs?rel=1492721696559:393 Uncaught TypeError: data.getasdfa is not a function
at Function.<anonymous> (edit.cljs?rel=1492721696559:393)
at Function.cljs.core.apply.cljs$core$IFn$_invoke$arity$2 (core.cljs:3685)
at cljs$core$apply (core.cljs:3676)
at render (core.cljs?rel=1491307518599:130)
at subscriptive.cljs?rel=1491911411675:48
at Object.render (core.cljs?rel=1491307518599:83)
at react-dom.inc.js:5250
at measureLifeCyclePerf (react-dom.inc.js:4529)
at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (react-dom.inc.js:5249)
at ReactCompositeComponentWrapper._renderValidatedComponent (react-dom.inc.js:5276)
After fixing the introducted mistake, figwheel reloads, but the app doesn’t want to load the new code anymore until I do a full refresh of the app:
react-dom.inc.js:11559 Uncaught TypeError: Cannot read property 'getHostNode' of null
at Object.getHostNode (react-dom.inc.js:11559)
at ReactCompositeComponentWrapper.getHostNode (react-dom.inc.js:4838)
at Object.getHostNode (react-dom.inc.js:11559)
at Object.updateChildren (react-dom.inc.js:4336)
at ReactDOMComponent._reconcilerUpdateChildren (react-dom.inc.js:10399)
at ReactDOMComponent._updateChildren (react-dom.inc.js:10503)
at ReactDOMComponent.updateChildren (react-dom.inc.js:10490)
at ReactDOMComponent._updateDOMChildren (react-dom.inc.js:6403)
at ReactDOMComponent.updateComponent (react-dom.inc.js:6221)
at ReactDOMComponent.receiveComponent (react-dom.inc.js:6183)
I think it would be an improvement if the first exception didn’t break future code updates (via figwheel). I don’t understand the React internals enough (yet) to see how complicated this might be.My work around now is to set an alert with the text “Uncaught fatal exception, check the logs and restart the app” whenever an error with “getHostNode” is being detected by window.onerror