stencil
stencil copied to clipboard
bug: dependency built with stencil, used in react project, the event triggered twice!
Prerequisites
- [X] I have read the Contributing Guidelines.
- [X] I agree to follow the Code of Conduct.
- [X] I have searched for existing issues that already report this problem, without success.
Stencil Version
2.13.0
Current Behavior
the details please check 'Steps to Reproduce' part.
Expected Behavior
click event should be triggered only once.
Steps to Reproduce
step1: create a component with stencil, let's call it TestClick;
step2: add event for TestClick;
// ok event
@Event({
eventName: 'ok',
composed: false,
cancelable: false,
bubbles: false,
})
onOk: EventEmitter<number>;
private _onOk = async (e) => {
e.preventDefault();
const okEv = this.onOk.emit('some value');
if (!okEv.defaultPrevented) {
console.log('not defaultPrevented');
return;
}
};
step3: use this component (TestClick) in another react project;
step4: add event click function, let's call it handleClick;
// use TestClick
<TestClick onOk={(e) => handleClick(e)}></TestClick>
// handler
const handleClick = (e) => {
console.log('aaaaaa');
};
then the log message 'aaaaaa' was logged twice, which means handleClick was called twice, not sure whether it is bubble issue or not, but this is a bit weird.
Code Reproduction URL
not now
Additional Information
please help to check, thanks.
Thanks for the issue! This issue has been labeled as needs reproduction. This label is added to issues that need a code reproduction.
Please reproduce this issue in an Stencil starter component library and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed.
If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue.
For a guide on how to create a good reproduction, see our Contributing Guide.
I'm going to close this issue due to lack of reproduction case. If this is still an issue, please feel free to create a new issue with a minimal reproduction URL for the team to pull down and take a look at. Thanks!