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

fix(framework): property with empty object as default value #8215

Merged
merged 2 commits into from
Feb 1, 2024

Conversation

nnaydenow
Copy link
Contributor

@nnaydenow nnaydenow commented Jan 31, 2024

Properties with type: Object that don't have specified default value in their declaration decorator have {} as default value.

This {} is stored in the initial state of the component and its reference is shared between instanced.

Same apply for multiple properties but with [] instead of {}

In some cases where the property value is changed with an index instead of a new reference, the component starts to behave wrongly because the value of the shared reference is changed.

this.propertyName.somethingNested = "Some new value"

With this change, we provide a new object reference whether the default value of the property is accessed

@nnaydenow nnaydenow merged commit b4e1eba into main Feb 1, 2024
8 checks passed
@nnaydenow nnaydenow deleted the default-object branch February 1, 2024 08: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.

None yet

2 participants