Fork me on GitHub

Hi, I’m trying to get sorted-maps to print like clojure.core/sorted-map, but can’t find my way around it, anyone able to help? image displays how data.avl/sorted-map is displayed in comparison to core/sorted-map (data.avl above, core below)


If you implement for the custom map types provided by data.avl, you can then automatically datafy all values sent to tap with something like:

(require '[clojure.datafy :as d])
(require '[portal.api :as p])

(def submit (comp p/submit d/datafy))
(add-tap submit)


Thanks, that solved the trick for making AVLMaps to print like clojure core sorted-maps, but I am observing that clojure core sorted-maps are not printing in order when using java.time.Instant as keys, any idea why this might be? (When printing it in the repl, they are printed in order)


I think this might be because portal treats all maps as hash maps on the client :thinking_face: Might need to revisit serialization around sorted maps.


By default the UI will always try to render maps in sorted order, so another option is to get tagged objects sorting


> Might need to revisit serialization around sorted maps. I’d go for this instead of sorting the tagged literal, as it will allow sorted maps with custom comparator to also work properly and display the sorted-maps order. Where can I find the code for this? I can try and give it a go myself


nvm found it 🙂 trying to setup a local env to develop portal, maybe a quick solution (that doesn’t require a new type) would be to check if map is sorted? to not sort in here: , something like (cond-> (not (sorted? values)) (try-sort-map))


The problem is that when the data reaches the client, that info is gone

👍 1

I’ll submit an issue then so this can be tracked there