fix: property names with invalid idents display an error notification

instead of silently failing in console. E.g. `123` as a property name
experiment/tanstack-table
Gabriel Horner 2024-05-20 16:57:41 -04:00
parent fa4b47d16b
commit 33832f7941
1 changed files with 7 additions and 1 deletions

View File

@ -104,7 +104,13 @@
it is ensured to have a unique :db/ident"
[conn property-id schema {:keys [property-name properties]}]
(let [db @conn
db-ident (or property-id (db-property/create-user-property-ident-from-name property-name))]
db-ident (or property-id
(try (db-property/create-user-property-ident-from-name property-name)
(catch :default e
(throw (ex-info (str e)
{:type :notification
:payload {:message "Property failed to create. Please try a different property name."
:type :error}})))))]
(assert (qualified-keyword? db-ident))
(if-let [property (and (qualified-keyword? property-id) (d/entity db db-ident))]
(let [changed-property-attrs