mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 17:18:21 -05:00
⚡ Restore performance optimization of direct prop access
Using safer optional chain operator
This commit is contained in:
parent
b70880420a
commit
ac207e276c
1 changed files with 5 additions and 8 deletions
|
@ -13,8 +13,8 @@
|
||||||
#?(:clj [clojure.core :as c]
|
#?(:clj [clojure.core :as c]
|
||||||
:cljs [cljs.core :as c])
|
:cljs [cljs.core :as c])
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[cuerdas.core :as str]
|
[cljs.analyzer.api :as aapi]
|
||||||
[cljs.analyzer.api :as aapi]))
|
[cuerdas.core :as str]))
|
||||||
|
|
||||||
(defmacro select-keys
|
(defmacro select-keys
|
||||||
"A macro version of `select-keys`. Useful when keys vector is known
|
"A macro version of `select-keys`. Useful when keys vector is known
|
||||||
|
@ -120,12 +120,9 @@
|
||||||
"A macro based, optimized variant of `get` that access the property
|
"A macro based, optimized variant of `get` that access the property
|
||||||
directly on CLJS, on CLJ works as get."
|
directly on CLJS, on CLJ works as get."
|
||||||
[obj prop]
|
[obj prop]
|
||||||
;; This throws an exception if obj is nul, that does not occur with CLJ get.
|
(if (:ns &env)
|
||||||
;; This is causing many internal errors in places that obj null does not harm and should not throw.
|
(list 'js* (c/str "(~{}?." (str/snake prop) ")") obj)
|
||||||
;; (if (:ns &env)
|
(list `c/get obj prop)))
|
||||||
;; (list (symbol ".") (with-meta obj {:tag 'js}) (symbol (str "-" (c/name prop))))
|
|
||||||
(list `c/get obj prop))
|
|
||||||
;;)
|
|
||||||
|
|
||||||
(def ^:dynamic *assert-context* nil)
|
(def ^:dynamic *assert-context* nil)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue