diff --git a/deps/db/src/logseq/db/frontend/malli_schema.cljs b/deps/db/src/logseq/db/frontend/malli_schema.cljs index 9c50c4c624..735f54dd39 100644 --- a/deps/db/src/logseq/db/frontend/malli_schema.cljs +++ b/deps/db/src/logseq/db/frontend/malli_schema.cljs @@ -89,30 +89,18 @@ expected to be a coll if the property has a :many cardinality. validate-fn is a fn that is called directly on each value to return a truthy value. validate-fn varies by property type" - [db validate-fn [property property-val] & {:keys [new-closed-value? _skip-strict-url-validate?] + [db validate-fn [property property-val] & {:keys [_skip-strict-url-validate?] :as validate-option}] ;; For debugging ;; (when (not (internal-ident? (:db/ident property))) (prn :validate-val (dissoc property :property/closed-values) property-val)) (let [validate-fn' (if (db-property-type/property-types-with-db (:logseq.property/type property)) (fn [value] (validate-fn db value validate-option)) - validate-fn) - validate-fn'' (if (and (db-property-type/closed-value-property-types (:logseq.property/type property)) - ;; new closed values aren't associated with the property yet - (not new-closed-value?) - (seq (:property/closed-values property))) - (fn closed-value-valid? [val] - (and (validate-fn' val) - (let [ids (set (map :db/id (:property/closed-values property))) - result (contains? ids val)] - (when-not result - (js/console.error (str "Error: not a closed value, id: " val ", existing choices: " ids ", property: " (:db/ident property)))) - result))) - validate-fn')] + validate-fn)] (if (db-property/many? property) - (or (every? validate-fn'' property-val) + (or (every? validate-fn' property-val) (empty-placeholder-value? db property (first property-val))) - (or (validate-fn'' property-val) + (or (validate-fn' property-val) ;; also valid if value is empty-placeholder (empty-placeholder-value? db property property-val))))) diff --git a/src/main/frontend/components/property/value.cljs b/src/main/frontend/components/property/value.cljs index 3555c8803a..51dad0a929 100644 --- a/src/main/frontend/components/property/value.cljs +++ b/src/main/frontend/components/property/value.cljs @@ -1096,7 +1096,12 @@ [:span.number (str value')] :else - (inline-text {} :markdown (str value')))))) + [:span.inline-flex.w-full + (let [value' (str value') + value' (if (string/blank? value') + "Empty" + value')] + (inline-text {} :markdown value'))])))) (rum/defc select-item [property type value {:keys [page-cp inline-text other-position? property-position table-view? _icon?] :as opts}]