        (patch/patch-seq
          ; Merged patch data to apply to the records.
          (patch/filter-patch
-           (.pending table) ; TODO: merge ::patch
+           (load-changes table)
            {:fields (:fields opts)
             :start-key start-key
             :end-key end-key})

  (fn decode-entry [[k r]] [(key/decode lexicoder k) r]))


(defn- -scan
  ([table]
   (-scan table nil))

  ([^Table table id-keys opts]
   (let [lexicoder (table-lexicoder table)
         id-keys (into #{} (map (partial key/encode lexicoder)) id-keys)
         patch-map (load-changes table)
         patch-entries (select-keys patch-map id-keys)
         extra-keys (apply disj id-keys (keys patch-entries))
         patch-entries (patch/filter-patch patch-entries {:fields (:fields opts)})
