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

Redefining DS.Model attributes #3906

Closed
courajs opened this issue Nov 3, 2015 · 6 comments
Closed

Redefining DS.Model attributes #3906

courajs opened this issue Nov 3, 2015 · 6 comments

Comments

@courajs
Copy link
Contributor

courajs commented Nov 3, 2015

In #3893 we found someone was accidentally overwriting DS.Model.errors in an extend block. It's also possible to overwrite other attributes (e.g. isLoading, hasDirtyAttributes) which can cause problem.
Is there a way for us to guard against these redefinitions, or display a warning in the console?

@wecc
Copy link
Contributor

wecc commented Nov 3, 2015

I think these are the only reserved properties at the moment:

'currentState', 'data', 'store'

@courajs
Copy link
Contributor Author

courajs commented Nov 3, 2015

I think a warning would be good. I could see isLoading being a useful model attribute in some domain, and also something addons might depend on.
Based on the history around that line, we have to be careful about distinctions between instance & class attributes.

@bmac
Copy link
Member

bmac commented May 26, 2016

Ember Data tried to add a warning around the state properties like (isLoading or hasDirtyAttributes) unfortunately it broke some apps that overrode these properties to provide additional behavior and the change was eventually reverted.

@courajs
Copy link
Contributor Author

courajs commented Jun 7, 2016

I was suggesting just a console warning rather than an assert. After all, some properties can be safely or usefully overridden (errors by a validation library, for example). Maybe with some mechanism for silencing the warning? An "I know what I'm doing" kind of option.

@wecc
Copy link
Contributor

wecc commented Oct 21, 2016

There are currently no plans on separating user properties from reserved/ED properties. An RFC proposing a solution would be welcomed!

@runspired
Copy link
Contributor

RecordData RFC will move us to a "pluggable" Model setup at which point users may experiment with stricter classes as desired. Closing in favor of that RFC.

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

4 participants