From 22645ac277b6d9f5956522bf2db98d9f8eb8e8da Mon Sep 17 00:00:00 2001 From: Kimo Knowles Date: Tue, 31 Oct 2023 09:51:39 +0100 Subject: [PATCH] Gracefully fail to sort unsortable maps in pods Fixes #406 --- src/day8/re_frame_10x/tools/datafy.cljs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/day8/re_frame_10x/tools/datafy.cljs b/src/day8/re_frame_10x/tools/datafy.cljs index 70058e1d..84791370 100644 --- a/src/day8/re_frame_10x/tools/datafy.cljs +++ b/src/day8/re_frame_10x/tools/datafy.cljs @@ -1,6 +1,7 @@ (ns day8.re-frame-10x.tools.datafy (:require [clojure.string :as str] - [clojure.walk :as walk])) + [clojure.walk :as walk] + [day8.re-frame-10x.inlined-deps.re-frame.v1v3v0.re-frame.loggers :refer [console]])) (defn keyboard-event [e] {:key (.-key e) @@ -29,7 +30,13 @@ (str/join "-" (conj mods key-str)))) (defn deep-sorted-map [m] - (walk/postwalk #(cond->> % (map? %) (into (sorted-map))) m)) + (walk/postwalk + #(if (map? %) + (try (into (sorted-map) %) + (catch :default _ + (do (console :warn "Warning: map has unsortable keys: " %) %))) + %) + m)) (defn alias [k ns->alias] (if-let [a (get ns->alias (namespace k))]