mirror of
https://github.com/penpot/penpot.git
synced 2025-03-15 17:21:17 -05:00
🐛 Fix unexpected exception on closing dropdown event
Caused by a incorrect call to the internal dropdown component
This commit is contained in:
parent
2d955a2256
commit
0bffca2dc7
2 changed files with 15 additions and 16 deletions
|
@ -11,7 +11,7 @@
|
||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
[app.common.schema :as sm]
|
[app.common.schema :as sm]
|
||||||
[app.main.refs :as refs]
|
[app.main.refs :as refs]
|
||||||
[app.main.ui.components.dropdown :refer [dropdown']]
|
[app.main.ui.components.dropdown :refer [dropdown-content*]]
|
||||||
[app.main.ui.icons :as i]
|
[app.main.ui.icons :as i]
|
||||||
[app.util.dom :as dom]
|
[app.util.dom :as dom]
|
||||||
[app.util.i18n :as i18n :refer [tr]]
|
[app.util.i18n :as i18n :refer [tr]]
|
||||||
|
@ -219,7 +219,7 @@
|
||||||
#(dom/focus! (dom/get-element (first ids)))))
|
#(dom/focus! (dom/get-element (first ids)))))
|
||||||
|
|
||||||
(when (and show (some? levels))
|
(when (and show (some? levels))
|
||||||
[:> dropdown' props
|
[:> dropdown-content* props
|
||||||
(let [level (peek levels)
|
(let [level (peek levels)
|
||||||
options (:options level)
|
options (:options level)
|
||||||
parent (:parent level)]
|
parent (:parent level)]
|
||||||
|
|
|
@ -12,17 +12,13 @@
|
||||||
[app.util.keyboard :as kbd]
|
[app.util.keyboard :as kbd]
|
||||||
[app.util.timers :as tm]
|
[app.util.timers :as tm]
|
||||||
[goog.events :as events]
|
[goog.events :as events]
|
||||||
[goog.object :as gobj]
|
|
||||||
[rumext.v2 :as mf])
|
[rumext.v2 :as mf])
|
||||||
(:import goog.events.EventType))
|
(:import goog.events.EventType))
|
||||||
|
|
||||||
(mf/defc dropdown'
|
(mf/defc dropdown-content*
|
||||||
{::mf/wrap-props false}
|
[{:keys [children on-close container]}]
|
||||||
[props]
|
(let [listening-ref (mf/use-ref nil)
|
||||||
(let [children (gobj/get props "children")
|
container-ref container
|
||||||
on-close (gobj/get props "on-close")
|
|
||||||
container-ref (gobj/get props "container")
|
|
||||||
listening-ref (mf/use-ref nil)
|
|
||||||
|
|
||||||
on-click
|
on-click
|
||||||
(fn [event]
|
(fn [event]
|
||||||
|
@ -57,10 +53,13 @@
|
||||||
children))
|
children))
|
||||||
|
|
||||||
(mf/defc dropdown
|
(mf/defc dropdown
|
||||||
{::mf/wrap-props false}
|
{::mf/props :obj}
|
||||||
[props]
|
[{:keys [on-close show children container]}]
|
||||||
(assert (fn? (gobj/get props "on-close")) "missing `on-close` prop")
|
(assert (fn? on-close) "missing `on-close` prop")
|
||||||
(assert (boolean? (gobj/get props "show")) "missing `show` prop")
|
(assert (boolean? show) "missing `show` prop")
|
||||||
|
|
||||||
(when (gobj/get props "show")
|
(when ^boolean show
|
||||||
(mf/element dropdown' props)))
|
[:> dropdown-content*
|
||||||
|
{:on-close on-close
|
||||||
|
:container container
|
||||||
|
:children children}]))
|
||||||
|
|
Loading…
Add table
Reference in a new issue