-
-
Notifications
You must be signed in to change notification settings - Fork 110
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
instanceDefaults as an object can cause complications #224
Comments
The code below will have instanceDefaults: {
arr: []
} The workaround is to do this: instanceDefaults: () => ({
arr: []
}) |
@james2mid thanks for making this more visible. Version 2.x will only allow the function version. I'm going to close this after it is released. |
See the PR above |
marshallswain
added a commit
that referenced
this issue
Jun 10, 2019
Warn against instanceDefaults as an object #224
marshallswain
pushed a commit
that referenced
this issue
Jun 14, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Neither a bug or a feature request
I'm posting this for myself to come back to at a later time unless someone else wants to do it.
The issue is with instanceDefaults as an object where it maintains the contents of any array or object properties between model instances. The workaround for this is to make instanceDefaults a function that returns the same object.
It took me a little while to figure out why this was happening and so I felt this should be more clear in the docs, especially for the less versed coders out there.
The text was updated successfully, but these errors were encountered: