Closed mmower closed 7 years ago
Yeah comparing Js objects is kinda tricky. I haven't really considered it originally to be honest. Looks like uuid compiles to an object, so can't really be compared easily. One workaround could be to preprocess the data in a custom function first. For example, you could prewalk and convert the uuid nodes into something meaningful.
Okay maybe a dumb question but... do we need to sort this stuff?
The problem is that maps are unordered, and without sorting you can end up with different element order each time data is rendered. This makes it tricky to scan if a particular item changed for example.
Okay I can see how that can be useful. On the other hand having to convert the entire data-structure on each render seems an overhead. Perhaps a compromise is to allow sorting to be configured? I'd compromise on losing it.
Yeah passing a flag could be an option, or perhaps there's a way to compare js objects more intelligently.
Maybe using something like (js->clj (.keys obj))
might do it.
Hi.
I think the implementation of sort-map may have a bug. Here's some REPL output:
It appears the problem is in
sorted-map-by
with the implementation ofstr-compare
since the call tostr
is returning[object Object]
and they all end up in the same key.I'm not immediately sure how to solve this one.