Browse Source

enhance(ux): fix the editor popup flicker when exiting

charlie 1 year ago
parent
commit
64a06568f7

+ 8 - 3
src/main/frontend/components/editor.cljs

@@ -33,9 +33,14 @@
             [rum.core :as rum]
             [frontend.config :as config]))
 
-(rum/defc commands < rum/reactive
-  [id format]
-  (let [matched (util/react *matched-commands)]
+(rum/defcs commands < rum/reactive
+  (rum/local [] ::matched-commands)
+  [s id format]
+  (let [matched' (util/react *matched-commands)
+        *matched (::matched-commands s)
+        _ (when (state/get-editor-action)
+            (reset! *matched matched'))
+        matched @*matched]
     (ui/auto-complete
       matched
       {:get-group-name

+ 1 - 1
src/main/frontend/components/editor.css

@@ -102,7 +102,7 @@ pre {
   }
 
   &[data-editor-popup-ref=commands] {
-    @apply px-1 py-1 w-72 data-[state=closed]:animate-none;
+    @apply px-1 py-1 w-72;
 
     &[data-side=top] {
       max-height: min(calc(var(--radix-popover-content-available-height) - 60px), 460px);