Give new annotations unique ids (gensym reset clobbered old ones)

open-draft used (gensym "ann-"), whose counter resets on every page load, so the
first annotation added after a refresh reused a prior gid (ann-2, …) and the
per-id merge overwrote the existing annotation. Use a uuid-based gid instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Your Name 2026-06-29 02:20:24 -04:00
parent ceccec8060
commit fcac22fe83

View file

@ -90,7 +90,9 @@
(rf/reg-event-db ::open-draft
(fn [db _]
(-> db
(assoc-in [:scene :groups (keyword (gensym "ann-"))]
;; uuid, not gensym: gensym's counter resets each page load, so a
;; fresh annotation would reuse a prior gid and clobber it on merge.
(assoc-in [:scene :groups (keyword (str "ann-" (random-uuid)))]
{:type :annotation :parent (peek (get-in db [:view :stack]))
:draft :new :name "" :color "#4e8fc2" :marks []})
(assoc-in [:view :pt] :new))))