Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove documents from store on collection deletion #LMR-793 #349

Merged
merged 2 commits into from
May 5, 2018

Conversation

kubedo8
Copy link
Contributor

@kubedo8 kubedo8 commented May 5, 2018

No description provided.

@kubedo8 kubedo8 requested a review from livthomas May 5, 2018 08:40
const ids: string[] = state.ids as string[];
const entities = state.entities;
return ids.map((id: string) => entities[id])
.filter(document => document.collectionId === collectionId)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we map ids to entities here? What about filtering just entities?

  return Object.values(state.entities)
    .filter(document => document.collectionId === collectionId)
    .map(document => document.id);

In the future, we will hopefully be able to remove entities by a predicate (see this NgRx issue).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I was looking for something like that, thanks!

@livthomas livthomas merged commit 5f2e184 into Lumeer:devel May 5, 2018
@kubedo8 kubedo8 deleted the LMR-793 branch November 6, 2023 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants