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

Setting readOnly AND computed on properties #1925

Closed
positlabs opened this issue Jun 19, 2015 · 2 comments
Closed

Setting readOnly AND computed on properties #1925

positlabs opened this issue Jun 19, 2015 · 2 comments
Assignees
Labels

Comments

@positlabs
Copy link

Obviously, we can't set a value on a computed property, but setting readOnly: true causes the computed property handler to never be called. Maybe there should be some warning, or even an error if a property is configured like this. Or possibly just ignore the readOnly flag if computed is defined.

                _optionLabels: {
                    type: Array,
                    value: [],
                    readOnly: true,
                    computed: '_computedOptionLabels(options)'
                },
@kevinpschaaf kevinpschaaf self-assigned this Jun 22, 2015
@kevinpschaaf
Copy link
Member

This is a bug.

The expected behavior is that making a property computed should implicitly make it readOnly, since it should never be set from outside, only as a result of the computing function running based on dependencies changing.

Currently it is neither readOnly by default, nor does attempting to make it readOnly manually work, as noted.

sorvell pushed a commit that referenced this issue Jun 24, 2015
Make computed properties implicitly readOnly. Fixes #1925.
@positlabs
Copy link
Author

Nice. Thanks for fixing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants