From cf5e8360bf669221114bc9ec7464157bd851bc22 Mon Sep 17 00:00:00 2001 From: Kimo Knowles Date: Thu, 8 Aug 2024 23:33:54 +0200 Subject: [PATCH] [flows] Memoize topsort correctly --- src/re_frame/flow/alpha.cljc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/re_frame/flow/alpha.cljc b/src/re_frame/flow/alpha.cljc index dffdf995..71909ffd 100644 --- a/src/re_frame/flow/alpha.cljc +++ b/src/re_frame/flow/alpha.cljc @@ -32,6 +32,8 @@ reverse (map flows))) +(def topsort* (memoize topsort)) + (defn default [id] {:id id :path [id] @@ -169,6 +171,6 @@ :after (comp (fn [ctx] (let [all-flows (with-cleared @flows)] (swap! flows vary-meta dissoc ::cleared) - (reduce run ctx ((memoize topsort) all-flows)))) + (reduce run ctx (topsort* all-flows)))) (fn [{{:keys [db]} :effects :as ctx}] (assoc ctx :re-frame/pre-flow-db db)))}))