Skip to content

Commit

Permalink
Log error when props are [], not {} (#461)
Browse files Browse the repository at this point in the history
Log error when props are not {} so that the programmer is notified when she forgot to map over a sequence (i.e. she called `(ui-person all-people)` instead of `(map ui-person all-people)`).
  • Loading branch information
holyjak committed Feb 21, 2021
1 parent 039ad85 commit 0bf8e61
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/com/fulcrologic/fulcro/components.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,12 @@
(log/warn "String ref on " (component-name class) " should be a function."))

(when (or (nil? props) (not (gobj/containsKey props "fulcro$value")))
(log/error "Props middleware seems to have the corrupted props for " (component-name class))))))
(log/error "Props middleware seems to have the corrupted props for " (component-name class)))

(when-not (map? (gobj/get props "fulcro$value"))
(log/error "Props passed to" (component-name class) "are of the type"
(type (gobj/get props "fulcro$value"))
"instead of a map. Perhaps you meant to `map` the component over the props?")))))
(create-element class props children)))
{:class class
:queryid qid
Expand Down

0 comments on commit 0bf8e61

Please sign in to comment.