dappsnation / akita-ng-fire

Akita ❤️ Angular 🔥 Firebase
MIT License
131 stars 27 forks source link

Incorrect store update after entity update #135

Closed TimVanMourik closed 4 years ago

TimVanMourik commented 4 years ago

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

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 become update => update(entityIds, data)

Fix Pass on entity id to update function, see PR #134

fritzschoff commented 4 years ago

thank you very much for reporting! merged with pr #134

TimVanMourik commented 4 years ago

Thanks for merging so quickly! 😎 Just wondering, is this auto-published to npm?

fritzschoff commented 4 years ago

nope but I will do now

fritzschoff commented 4 years ago

@TimVanMourik your fix is now available at 3.0.3

TimVanMourik commented 4 years ago

Thanks! I'll test ASAP 🎉

TimVanMourik commented 4 years ago

Tested and working 🥇