Skip to content

changing a $state value inside a drag event fires the event twice #14496

@ssebastianoo

Description

@ssebastianoo

Describe the bug

When inside a drag event, like dragenter or dravleave, changing a $state value will fire the event again

Reproduction

let dropping = $state(false);

onMount(() => {
  window.addEventListener('dragenter', (e) => {
	  e.preventDefault();
	  console.log('dragenter fired');
	  dropping = true; // this re-runs the event
  });
...

Logs

No response

System Info

System:
    OS: macOS 15.2
    CPU: (8) arm64 Apple M2
    Memory: 150.88 MB / 8.00 GB
    Shell: 3.7.1 - /opt/homebrew/bin/fish
Binaries:
    Node: 20.9.0 - /usr/local/bin/node
    Yarn: 1.22.21 - /usr/local/bin/yarn
    npm: 10.5.1 - /usr/local/bin/npm
    pnpm: 9.0.3 - /usr/local/bin/pnpm
    bun: 1.1.34 - ~/.bun/bin/bun
    Watchman: 2024.10.14.00 - /opt/homebrew/bin/watchman
npmPackages:
    @sveltejs/adapter-auto: ^3.0.0 => 3.3.1 
    @sveltejs/adapter-vercel: ^5.4.8 => 5.4.8 
    @sveltejs/kit: ^2.0.0 => 2.8.5 
    @sveltejs/vite-plugin-svelte: ^4.0.0 => 4.0.2 
    svelte: ^5.0.0 => 5.2.10 
    vite: ^5.0.3 => 5.4.11

Severity

serious, but I can work around it

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting submitterneeds a reproduction, or clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions