localbase icon indicating copy to clipboard operation
localbase copied to clipboard

fix: when collection does not have property, should still sort

Open eugenethered opened this issue 3 years ago • 0 comments

There's an issue when collection does not have a property when performing orderBy.

For example: Let's say you store multiple entities... as cats.

  1. {name: "socks", born: "2001"}
  2. {name: "ginger"}
  3. {name: "furball, born: "2020"}

If you use the existing code and try orderBy('born') it will explode💥 because the property "born" for ginger does not exist.

The fix Essentially it just does a simple check that both compared entities, both have the desired property.

Hope this helps.

eugenethered avatar Jun 25 '21 07:06 eugenethered