Skip to content

Loading…

Setting readOnly AND computed on properties #1925

Closed
positlabs opened this Issue · 2 comments

2 participants

@positlabs

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 added the p1 label
@kevinpschaaf kevinpschaaf self-assigned this
@kevinpschaaf

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.

@positlabs

Nice. Thanks for fixing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.