Closed TimVanMourik closed 4 years ago
thank you very much for reporting! merged with pr #134
Thanks for merging so quickly! 😎 Just wondering, is this auto-published to npm?
nope but I will do now
@TimVanMourik your fix is now available at 3.0.3
Thanks! I'll test ASAP 🎉
Tested and working 🥇
Type Bug
Description I was playing around with your library and noticed that an after updating an entity, the new entity data appeared at the root level of my store instead of within the entity.
Steps to reproduce
foo: "bar"
or by programmatically bythis.movieService.update({ id: 1, foo: "bar" })
movies --> { id: 1, foo: "bar" }
Desired store update (diff)movies --> entities --> 1 --> { id: 1, foo: "bar" }
Reason The store is updated with an incorrect update function (missing id) in line 44: https://github.com/dappsnation/akita-ng-fire/blob/b9062a8c9a4b62e8d6d1ae6355255164177cea17/projects/akita-ng-fire/src/lib/utils/sync-from-action.ts#L36-L46 The update function is missing the entity id.
Solution Per the Akita documentation:
runEntityStoreAction(BooksStore, EntityStoreAction.UpdateEntities, update => update(2, { title: 'New title' }));
So this should do the trick:update => update(data)
should becomeupdate => update(entityIds, data)
Fix Pass on entity id to update function, see PR #134