eldomagan / vuex-orm-localforage

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

Uncaught TypeError using $update #4

Closed ZeroThe2nd closed 5 years ago

ZeroThe2nd commented 5 years ago

When updating data with the following:

Model.$update(
  { where : 1 },
  data : {
    field: 'value'}
  )

I'm receiving the following error: Uncaught (in promise) TypeError: result[entity].forEach is not a function

The error is referring to the result[entity].forEach( ... ) on line 18 of src/actions/Persist.js, and when executing a $update, entity in result[entity] contains the string value $id. The contents of result are is the model in question.

Repeating this through the debugger with a Model.$create, the contents of entity is the string value operations, and result is an object with key operations holding an array of values that should be saved.

The value is not updated in the database, nor in vuex itself when using $update, while $create works without errors or issues.