question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect store update after entity update

See original GitHub issue

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

  • Subscribe to a (sub)collection
  • Update an entity in the Firestore manually by for example adding a field foo: "bar" or by programmatically by this.movieService.update({ id: 1, foo: "bar" })
  • The movie store will update incorrectly: Actual store update (diff) 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 become update => update(entityIds, data)

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
TimVanMourikcommented, Jul 30, 2020

Tested and working 🥇

1reaction
TimVanMourikcommented, Jul 30, 2020

Thanks! I’ll test ASAP 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Entity Framework: "Store update, insert, or delete statement ...
I am using Entity Framework to populate a grid control. Sometimes when I make updates I get the following error: Store update, insert,...
Read more >
How can I solve it mistake? Store update, insert, or delete ...
Entity.Infrastructure.DbUpdateConcurrencyException: 'Store update, insert, or delete statement affected an unexpected number of rows (0).
Read more >
Hibernate's persist(), save(), merge() and update()
You can use the methods persist and save to store a new entity and the methods merge and update to store the changes...
Read more >
Entity is not updating when I update it - nopCommerce
I have created my custom entity in nopCommerce 3.0. I have successfully implemented Insert/Update/Delete on this entity. My update will done on custom ......
Read more >
Offline Store Update Issue for Android Platform
When we are updating any existing record in offline store that time we are getting. Error:value":"[-10128] The request on an entity failed ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found