From de0d0cd17a0063dd3454f755440f536d121eb248 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Tue, 28 Oct 2025 22:32:20 +0800 Subject: [PATCH] fix: num prefixed properties in hidden-columns --- src/main/frontend/worker/db/validate.cljs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/frontend/worker/db/validate.cljs b/src/main/frontend/worker/db/validate.cljs index 967d554a95..82fdefed63 100644 --- a/src/main/frontend/worker/db/validate.cljs +++ b/src/main/frontend/worker/db/validate.cljs @@ -114,9 +114,16 @@ (->> (d/datoms db :avet (:v d)) (mapcat (fn [d] [[:db/retract (:e d) (:a d) (:v d)] - [:db/add (:e d) new-db-ident (:v d)]])))))))))] - (when (seq tx-data) - (ldb/transact! conn tx-data)))) + [:db/add (:e d) new-db-ident (:v d)]]))))))))) + ;; FIXME: :logseq.property.table/hidden-columns should be :property type to avoid issues like this + hidden-columns-tx-data (->> (d/datoms db :avet :logseq.property.table/hidden-columns) + (keep (fn [d] + (when (re-find #"^(\d)" (name (:v d))) + (let [new-value (keyword (namespace (:v d)) (string/replace-first (name (:v d)) #"^(\d)" "NUM-$1"))] + [:db/add (:e d) (:a d) new-value]))))) + tx-data' (concat tx-data hidden-columns-tx-data)] + (when (seq tx-data') + (ldb/transact! conn tx-data')))) (defn validate-db [conn]