Просмотр исходного кода

fix: notification status somehow takes non-keyword status

Tienson Qin 3 месяцев назад
Родитель
Сommit
0860d295db
2 измененных файлов с 2 добавлено и 1 удалено
  1. 1 0
      src/main/frontend/handler/notification.cljs
  2. 1 1
      src/main/frontend/ui.cljs

+ 1 - 0
src/main/frontend/handler/notification.cljs

@@ -26,6 +26,7 @@
   ([content status clear? uid timeout]
   ([content status clear? uid timeout]
    (show! content status clear? uid timeout nil))
    (show! content status clear? uid timeout nil))
   ([content status clear? uid timeout close-cb]
   ([content status clear? uid timeout close-cb]
+   (assert (keyword? status) "status should be a keyword")
    (let [contents (state/get-notification-contents)
    (let [contents (state/get-notification-contents)
          uid (or uid (keyword (util/unique-id)))]
          uid (or uid (keyword (util/unique-id)))]
      (state/set-state! :notification/contents (assoc contents
      (state/set-state! :notification/contents (assoc contents

+ 1 - 1
src/main/frontend/ui.cljs

@@ -295,7 +295,7 @@
               (icon "info-circle" {:class "text-indigo-500" :size "20"}))
               (icon "info-circle" {:class "text-indigo-500" :size "20"}))
             status)]
             status)]
       [:div.ui__notifications-content
       [:div.ui__notifications-content
-       {:class (str "notification-" (name (or status :info)))
+       {:class (str "notification-" (name (or (when (keyword? status) status) :info)))
         :style
         :style
         (when (or (= state "exiting")
         (when (or (= state "exiting")
                   (= state "exited"))
                   (= state "exited"))