-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Open
Labels
has workaroundA workaround has been found to avoid the problemA workaround has been found to avoid the problemneed discussionscope: custom elements
Description
Vue version
3.5.22
Link to minimal reproduction
Steps to reproduce
- Define a custom element
- Expose a settable property on it
- Try to set it's value
What is expected?
The value should be updated.
Even though the linked reproduction link is a stupid example and can be solved in other ways (props) I still think it would be nice to allow settable properties to expose some internal mechanism which can not be done using props.
From what I can see in the debugger this is how they are defined atm:
for (const key in exposed) {
if (!hasOwn(this, key)) {
Object.defineProperty(this, key, {
// unwrap ref to be consistent with public instance behavior
get: () => unref(exposed[key])
});
} else {
warn(`Exposed property "${key}" already exists on custom element.`);
}
}
As you see there is no setter defined here which puzzles me a little bit why that should be the case.
What is actually happening?
The set operation is ignored/causes a warning that the property is not settable.
System Info
Any additional comments?
No response
coderabbitai
Metadata
Metadata
Assignees
Labels
has workaroundA workaround has been found to avoid the problemA workaround has been found to avoid the problemneed discussionscope: custom elements