jsdata

js-data unsaved not returning objects with changes


I have a user from my API in my js-data store and I changed it's name. I didn't save the record yet.

Why doesn't ds.unsaved('user') return an empty array?


Solution

  • The unsaved() function returns only records that have no id. No matter if they have changes or not.

    According to the docs

    Return all "unsaved" (not uniquely identifiable) records in this colleciton.