浏览代码

fix: some unique "key" prop issues (#4773)

* fix: some unique "key" prop issues
Peng Xiao 3 年之前
父节点
当前提交
721b56f12e
共有 3 个文件被更改,包括 5 次插入4 次删除
  1. 1 1
      src/main/frontend/components/block.cljs
  2. 2 1
      src/main/frontend/components/settings.cljs
  3. 2 2
      src/main/frontend/ui.cljs

+ 1 - 1
src/main/frontend/components/block.cljs

@@ -198,7 +198,7 @@
                    (when @*resizing-image? (util/stop e)))}
         (and (:width metadata) (not (util/mobile?)))
         (assoc :style {:width (:width metadata)}))
-      [:div.asset-container
+      [:div.asset-container {:key "resize-asset-container"}
        [:img.rounded-sm.shadow-xl.relative
         (merge
          {:loading "lazy"

+ 2 - 1
src/main/frontend/components/settings.cljs

@@ -385,7 +385,8 @@
       (notification/show! (str "The page \"" value "\" doesn't exist yet. Please create that page first, and then try again.") :warning))))
 
 (defn journal-row [t enable-journals?]
-  [(toggle "enable_journals"
+  [:span
+   (toggle "enable_journals"
            (t :settings-page/enable-journals)
            enable-journals?
            (fn []

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

@@ -137,7 +137,7 @@
                        (when icon icon)
                        [:div {:style {:margin-right "8px"}} title]])]
           (if hr
-            [:hr.my-1]
+            [:hr.my-1 {:key "dropdown-hr"}]
             (rum/with-key
               (menu-link new-options child)
               title))))
@@ -834,7 +834,7 @@
                                (log/error :exception e)
                                [:div]))
                            [:div {:key "tippy"} ""])))
-           child)))
+            (rum/fragment {:key "tippy-children"} child))))
 
 (defn slider
   [default-value {:keys [min max on-change]}]