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

Calling Update on Store Mutates Entity Structure #823

Open
Brian-Hofmann opened this issue May 19, 2022 · 0 comments
Open

Calling Update on Store Mutates Entity Structure #823

Brian-Hofmann opened this issue May 19, 2022 · 0 comments

Comments

@Brian-Hofmann
Copy link

Is this a regression?

No

Description

Whenever I call the update method on the store, the entity gets mutated from the current structure I have. This is due to the constructor call in the updateEntities.js file.

image

I have a custom constructor for my entities which takes in the properties of the object instead of a raw object. Passing in "merged" to my constructor causes the id field to get set to the entire object since it is the first parameter.

Example of my object:

property1: number;
property2: string;

constructor(param1: number, param2: string) {
   this.property1 = param1;
   this.property2 = param2;
} 

Calling update on my entity causes param1 to receive the entire object, thus I get a new object that looks like:

{ property1: { property1: 1, property2: 'someString' }, property2: undefined }

Thank you for your help on this!

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in

No response

Anything else?

No response

Do you want to create a pull request?

No

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