Closed p-himik closed 1 year ago
Hey, thanks for the report.
Repro is good. I'm going to forgo the custom comparator, since we can't handle every case.
Now when a subtree is unsortable, it will gracefully fail, and the rest of the tree will still sort.
In the rare case a user needs to inspect an unsortable map as a sorted map, they can figure out how to sort it themselves IMO.
I'm going to forgo the custom comparator, since we can't handle every case.
@kimo-k If you follow this guide, you'll handle the vast majority of all the cases: https://clojure.org/guides/comparators#_comparators_that_work_between_different_types
Looks like there's a library mentioned in that article, so I think we can support this.
Not sure if we still need error handling, then. I took it out for now.
What happened?
Steps to reproduce:
(swap! re-frame.db/app-db assoc :x 1 "x" 2)
The root cause is that
day8.re-frame-10x.tools.datafy/deep-sorted-map
usessorted-map
. A potential solution is to usesorted-map-by
and pass to it a comparator that compares not only based on values but also based on types. It won't handle values that are of the same type but can't be compared - perhaps that case should be caught and reported in a more friendly way suggesting the user to change the data types or avoid sorting them.Factory Reset
10x Version
1.8.1
Reagent Version
1.2.0
React Version
17.0.2
re-frame Version
1.3.0
What browsers are you seeing the problem on?
No response
Relevant console output
When expanding the above: