mirror of https://github.com/sveltejs/svelte
fix: prevent event delegation logic conflicting between svelte instances (#17728)
Fixes https://github.com/sveltejs/svelte.dev/issues/1793. There are actually two fixes here, and either is sufficient to fix the playground, but they are complementary. First, we only add the delegated event handler _after_ the component has successfully mounted, otherwise it will never get cleaned up if an error occurs during mount. Second, instead of storing data on `event.__root` (which leaks between instances), we reuse the existing `event_symbol` to provide the necessary encapsulation. (I'll be honest I don't totally understand what this property is for anyway and can't be bothered to figure it out right now, but I'm sure it's important.) No test because I'm not really sure how you _would_ test this; it requires a fairly esoteric setup. ### Before submitting the PR, please make sure you do the following - [x] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs - [x] Prefix your PR title with `feat:`, `fix:`, `chore:`, or `docs:`. - [x] This message body should clearly illustrate what problems it solves. - [ ] Ideally, include a test that fails without this PR but passes with it. - [x] If this PR changes code within `packages/svelte/src`, add a changeset (`npx changeset`). ### Tests and linting - [x] Run the tests with `pnpm test` and lint the project with `pnpm lint` --------- Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>pull/17725/head
parent
60a425193c
commit
e47c747338
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: prevent event delegation logic conflicting between svelte instances
|
||||
Loading…
Reference in new issue