upsert-gig inserts nil id
dmrq70 opened this issue · 4 comments
dmrq70 commented
I'm getting an error in the browser console for duplicate keys, I believe it's because in upsert-gig, id is only set to random-uuid inside the map but the key for the assoc remains nil.
I think it should something like:
upsert-gig (fn [{:keys [id title desc price img sold-out]}]
(let [id (or id (str "gig-" (random-uuid)))]
(swap! state/gigs assoc id {:id id
:title (str/trim title)
:desc (str/trim desc)
:img (str/trim img)
:price (js/parseInt price)
:sold-out sold-out}))
(toggle-modal {:active false :gig {}}))
jacekschae commented
Hey there,
It's fixed in following videos, early catch 👍
Enjoy the course!
jacekschae commented
@dmrq70 can we close this now?
dmrq70 commented
Sorry, only checked in one or two of the following 'increments'.
jacekschae commented
@dmrq70 no problem at all.