Browse Source

enhance: skip non-editing routes for undo/redo

Tienson Qin 1 year ago
parent
commit
8c7edd08e1
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/main/frontend/persist_db/browser.cljs

+ 3 - 1
src/main/frontend/persist_db/browser.cljs

@@ -57,7 +57,9 @@
                                (assoc :route-data (get-route-data (:route-match state)))))
                        old-state (f prev)
                        new-state (f current)]
-                   (when (not= new-state old-state)
+                   (when (and (not= new-state old-state)
+                              (not (and (= (dissoc new-state :route-data) (dissoc old-state :route-data))
+                                        (not (contains? #{:page :page-block :home :all-journals} (:to (:route-data new-state)))))))
                      (.sync-ui-state worker (state/get-current-repo)
                                      (ldb/write-transit-str {:old-state old-state
                                                              :new-state new-state}))))))))