eldomagan / vuex-orm-localforage

Vuex ORM persistence plugin to sync the store against IndexedDB using localforage
MIT License
58 stars 9 forks source link

Extra Methods return indexed data array with missing model context #24

Open adm-bome opened 3 years ago

adm-bome commented 3 years ago

Hi,

The extra methods: prefixed with a $ sign, do work. There is only one issue that bothers me.

When the extra methods resolve, and everything is as it should supposed to be, the result is a array of records without context.

The way vuex-orm returns the result is in an multidimentional assoc array with the key being the models entity name. Vuex-orm method like: update returns multiple records, but grouped by there model entity name.

The methods (in this lib) like: $update return an flattend indexed array with records. There is no way to know what typeof record it is when looping though them.

For example: when you want to store a Contact with a or multiple relation(s) to a Address model.

Is there some special reason the outputs are different? Did nobody noticed this type of behavior?

In my humble opinion the outputs/resolved returns should be inline with each other. Mainly because this is only a plugin that adds an extra abbility and should not define or alter outputs.