mirror of
https://github.com/penpot/penpot.git
synced 2026-10-29 14:00:37 +00:00
💄 Clear the overlay's lint warning and formatting drift
The cascade's verify gate lints backend, common, and frontend/src/bench, and clj-kondo exits non-zero on a warning, so the redundant let in apply-set-token-set held every rebuilt candidate of this branch back. The two lets become one, with no change in behaviour. An unused pid binding in graph-overlay-test gets its underscore. cljfmt fix over the three files ./scripts/ci reported as formatted incorrectly, so the backend and frontend fmt checks pass. clj-kondo over the verify scope: 0 errors, 0 warnings. The overlay suites: 56 tests, 788 assertions, 0 failures. AI-assisted-by: claude-opus-5-5
This commit is contained in:
parent
314d82b60f
commit
bf1efeff6e
@ -547,7 +547,7 @@
|
||||
[(:shape/id ent)
|
||||
{:parent-id (:shape/id (:shape/parent ent))
|
||||
:shapes (into [] (map #(:shape/id (d/entity db %)))
|
||||
(get children eid))
|
||||
(get children eid))
|
||||
:component-id (:shape/component-id ent)
|
||||
:shape-ref (:shape/shape-ref ent)}])))
|
||||
eids)))
|
||||
@ -701,7 +701,7 @@
|
||||
(if (d/entid db [:component/id id])
|
||||
(ok db)
|
||||
(let [tx (into [{:db/id -1 :component/id id :component/document (doc-eid db)}]
|
||||
(component-attrs-tx -1 change))]
|
||||
(component-attrs-tx -1 change))]
|
||||
(ok (with-component-reresolved (d/db-with db tx) id)))))
|
||||
|
||||
(defn- clear-component-container-tx
|
||||
@ -1130,23 +1130,23 @@
|
||||
(skip db :missing-token-set-id)
|
||||
|
||||
:else
|
||||
(let [name* (ctob/normalize-set-name (:name attrs))
|
||||
holder (name-holder (set-names db) name* existing)]
|
||||
(let [set-ref (or existing (overlay/token-set-tempid id))
|
||||
old (into (if holder (retract-token-set-tx db holder) [])
|
||||
(map (fn [eid] [:db.fn/retractEntity eid]))
|
||||
(when existing (set-token-eids db existing)))
|
||||
new (into [{:db/id set-ref
|
||||
:token-set/id id
|
||||
:token-set/name name*
|
||||
:token-set/document (doc-eid db)}]
|
||||
(token-entities set-ref (:tokens attrs)))]
|
||||
;; two transactions: the retraction frees the identities the
|
||||
;; second one asserts, so no upsert has to resolve against a
|
||||
;; retracted row
|
||||
(ok (-> db
|
||||
(cond-> (seq old) (d/db-with old))
|
||||
(d/db-with new))))))))
|
||||
(let [name* (ctob/normalize-set-name (:name attrs))
|
||||
holder (name-holder (set-names db) name* existing)
|
||||
set-ref (or existing (overlay/token-set-tempid id))
|
||||
old (into (if holder (retract-token-set-tx db holder) [])
|
||||
(map (fn [eid] [:db.fn/retractEntity eid]))
|
||||
(when existing (set-token-eids db existing)))
|
||||
new (into [{:db/id set-ref
|
||||
:token-set/id id
|
||||
:token-set/name name*
|
||||
:token-set/document (doc-eid db)}]
|
||||
(token-entities set-ref (:tokens attrs)))]
|
||||
;; two transactions: the retraction frees the identities the
|
||||
;; second one asserts, so no upsert has to resolve against a
|
||||
;; retracted row
|
||||
(ok (-> db
|
||||
(cond-> (seq old) (d/db-with old))
|
||||
(d/db-with new)))))))
|
||||
|
||||
(defn- apply-set-token
|
||||
"Mirror of `process-change :set-token`: `ctob/delete-token` when
|
||||
|
||||
@ -948,7 +948,7 @@
|
||||
data1 (cp/process-changes data0 changes false)
|
||||
crippled (remove #(= :reorder-children (:type %)) changes)
|
||||
synced (into {} (normal-form (:db (sync/apply-changes (overlay/build data0)
|
||||
crippled))))
|
||||
crippled))))
|
||||
rebuilt (into {} (normal-form (overlay/build data1)))
|
||||
moved (into {}
|
||||
(keep (fn [[key attrs]]
|
||||
|
||||
@ -362,7 +362,7 @@
|
||||
[?s :shape/id ?sid]]
|
||||
db queries/rules))
|
||||
expected (set (for [component live-comps
|
||||
[pid page] (:pages-index data)
|
||||
[_pid page] (:pages-index data)
|
||||
[sid shape] (:objects page)
|
||||
:when (ctk/instance-of? shape (:id data) (:id component))]
|
||||
[(:id component) sid]))
|
||||
|
||||
@ -59,15 +59,15 @@
|
||||
[?d :shape/id ?id]]
|
||||
db rules "root")))
|
||||
rev-rows (count (e/q '[:find [?id ...] :in $ ?cid ?fid
|
||||
:where [?e :shape/component-id ?cid]
|
||||
[?e :shape/component-file ?fid]
|
||||
[?e :shape/id ?id]]
|
||||
db component-id file-id))
|
||||
:where [?e :shape/component-id ?cid]
|
||||
[?e :shape/component-file ?fid]
|
||||
[?e :shape/id ?id]]
|
||||
db component-id file-id))
|
||||
desc-rows (count (e/q '[:find [?id ...] :in $ % ?rn
|
||||
:where [?root :shape/name ?rn]
|
||||
(descendant-of-walk ?d ?root)
|
||||
[?d :shape/id ?id]]
|
||||
db rules "root"))
|
||||
:where [?root :shape/name ?rn]
|
||||
(descendant-of-walk ?d ?root)
|
||||
[?d :shape/id ?id]]
|
||||
db rules "root"))
|
||||
fmt #(.toFixed % 2)]
|
||||
(println (pr-str {:engine e/engine
|
||||
:build-ms (fmt build-ms)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user