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

Upsert Function #35

Open
pierresigwalt opened this issue Apr 11, 2018 · 0 comments
Open

Upsert Function #35

pierresigwalt opened this issue Apr 11, 2018 · 0 comments

Comments

@pierresigwalt
Copy link

pierresigwalt commented Apr 11, 2018

Hi,

I have trouble using the library for the following case. When using entities I have access to the createEntityAdapter upsert and uspertMany.

Scenario:

export interface Post {
    id: number;
    author?: Author[];
}

export interface Author {
    id: number;
}
export const authorSchema = new schema.Entity('author');
export const PostSchema = new schema.Entity('Post', {
    author: [authorSchema]
});

I am able to insert child Author to the Post. However I have a case where I am inserting the author if it's doesn't exist inside the Post and if existing I want to update these specific Author(s) with the value (basically an upsertMany or upsert). Today when using AddChildData the value is updated however the normalised reference is inserted 2 times (Eg. In post I got author[132,132]).

The question shouldn't be useful to have an uspertMany an upsert function?

Thank you

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

No branches or pull requests

1 participant