This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-27
Channels
- # announcements (3)
- # babashka (16)
- # beginners (177)
- # calva (102)
- # cider (2)
- # clj-kondo (12)
- # clojars (10)
- # clojure (91)
- # clojure-argentina (3)
- # clojure-australia (5)
- # clojure-europe (16)
- # clojure-nl (1)
- # clojure-uk (10)
- # clojurescript (73)
- # community-development (8)
- # cursive (9)
- # depstar (7)
- # fulcro (5)
- # helix (1)
- # introduce-yourself (1)
- # jobs-discuss (18)
- # lsp (32)
- # luminus (1)
- # malli (2)
- # music (4)
- # off-topic (20)
- # pathom (19)
- # polylith (15)
- # re-frame (4)
- # reagent (6)
- # ring (13)
- # sci (36)
- # shadow-cljs (7)
- # spacemacs (4)
- # sql (3)
- # tools-deps (112)
- # vim (21)
When you get an error like Uncaught Error: Assert failed: Invalid Hiccup form: [nil #{} {:x 9.004647827148437, :y 3.113865280151367}] (in nyancad.mosaic.frontend.schematic_canvas)
how do you trace that back to the code that generated that element? The stacktrace is just a bunch of reagents stuff.
It just gives the top-level function so it could be anywhere...
There are only a very few cases where you should get that error, i.e. if the first element is not a keyword or a function. Here it’s the component itself which is nil
(the first element of the vector) which indicates that there’s probably a typo. Do you get a compiler warning about the use of an undeclared var in that namespace? If there’s something more elaborate going on, like dynamically passing the component, it’s probably good practice to include an assert that it’s not nil so you get a more useful error
Yea I'm doing some dynamic stuff...
Then it’s a bit of a detective game 😅 I’d definitely include something in those dynamic components which throws before it returns invalid Hiccup forms
Ok yea adding asserts helps catch the error where it happens.