Prechádzať zdrojové kódy

fix: remove dedupe-by since it doesn't allow consecutive writes

Tienson Qin 1 rok pred
rodič
commit
281ae72619
2 zmenil súbory, kde vykonal 1 pridanie a 20 odobranie
  1. 1 4
      src/main/frontend/state.cljs
  2. 0 16
      src/main/frontend/util.cljc

+ 1 - 4
src/main/frontend/state.cljs

@@ -31,10 +31,7 @@
      :today                                 nil
      :system/events                         (async/chan 1000)
      :db/batch-txs                          (async/chan 1000)
-     :file/writes                           (async/chan 10000
-                                                        (util/dedupe-by
-                                                         (fn [[repo page-id outliner-op _epoch]]
-                                                           [repo page-id outliner-op])))
+     :file/writes                           (async/chan 10000)
      :file/unlinked-dirs                    #{}
      :reactive/custom-queries               (async/chan 1000)
      :notification/show?                    false

+ 0 - 16
src/main/frontend/util.cljc

@@ -1513,19 +1513,3 @@ Arg *stop: atom, reset to true to stop the loop"
      (if (satisfies? IMeta o)
        (with-meta o meta)
        o)))
-
-
-(defn dedupe-by
-  ([keyfn]
-   (fn [rf]
-     (let [pa (volatile! ::none)]
-       (fn
-         ([] (rf))
-         ([result] (rf result))
-         ([result input]
-          (let [prior @pa
-                key (keyfn input)]
-            (vreset! pa key)
-            (if (= prior key)
-              result
-              (rf result input)))))))))