michaelkrone / ngrx-normalizr

Managing normalized state in ngrx applications - transparently
https://michaelkrone.github.io/ngrx-normalizr/
MIT License
50 stars 17 forks source link

Deleting items does not remove them from the parent #24

Closed tommueller closed 6 years ago

tommueller commented 6 years ago

When I delete something from my store using the RemoveData-action the item gets deleted from the store, but the reference from the parent does not get removed.

Examples

{ "id": "page1", "sections": [{ "id": "section1" }] } normalizr turns this into:

{ normalized: { result: [ 'page1' ], entities: { sections: { sektion1: { id: 'sektion1' } }, pages: { seite1: { id: 'seite1', sections: ['sektion1'] } } } }

Now I run this.store.dispatch(new RemoveData({ id: section.id, schema: sectionSchema })); which leads to the following state: { normalized: { result: [ 'page1' ], entities: { sections: { }, pages: { seite1: { id: 'seite1', sections: ['sektion1'] } } } }

Which obviously breaks the code then ... any ideas why this is happening?

michaelkrone commented 6 years ago

Please see #20 RemoveChildData support is comming in v2.2.0

tommueller commented 6 years ago

@michaelkrone working fine for me as well! Thanks for the fast fixes!