We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When there are 2 nested components
<Master> <Minion /> </Master>
a Minion, which uses an action that dispatches a Custom Event on mount
// Minion.svelte <script> const dispatchSomeEvent = (node) => { // This is called on mount console.log('marco') const someEvent = new CustomEvent('someEvent', { bubbles: true }); node.dispatchEvent(someEvent); } </script> <div use:dispatchSomeEvent />
and a Master, which handles the event.
// Master.svelte <div on:someEvent={(event) => { // This SHOULD be called on mount of the child console.log('polo') }}> <slot /> </div>
The console printout should be "marco" "polo" - but it is not. The Master never handles the event on initial mount.
Looking at the generated code
m(target, anchor) { insert(target, div, anchor); if (default_slot) { default_slot.m(div, null); } current = true; if (!mounted) { dispose = listen(div, "someEvent", /*someEvent_handler*/ ctx[2]); mounted = true; } }
the mounting of the slot happens before the event handlers are registered.
Is there are reason for this order?
Link to REPL
No response
System independent
annoyance
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
When there are 2 nested components
a Minion, which uses an action that dispatches a Custom Event on mount
and a Master, which handles the event.
The console printout should be "marco" "polo" - but it is not. The Master never handles the event on initial mount.
Looking at the generated code
the mounting of the slot happens before the event handlers are registered.
Is there are reason for this order?
Reproduction
Link to REPL
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: