Skip to content

fix: deconflict multiple snippets of the same name #12221

New issue

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

Merged
merged 4 commits into from
Jun 30, 2024
Merged

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Jun 28, 2024

Fixes #12186

Copy link

changeset-bot bot commented Jun 28, 2024

🦋 Changeset detected

Latest commit: 1c99218

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Rich-Harris
Copy link
Member

I don't follow where exactly, but this is causing additional effects to be created. Using the test in this PR:

export default function App($$anchor) {
  // ...

  var div = $.sibling($.sibling(button, true));

  {
    var div_1 = $.child(div);

    {
      // ...

+     $.template_effect(() => {});
    }

    var div_2 = $.sibling($.sibling(div_1, true));

    {
      // ...

+     $.template_effect(() => {});
    }

+   $.template_effect(() => {});
  }

  $.append($$anchor, fragment);
}

$.delegate(["click"]);

Also, how complicated would it be to only create the block statement in cases where a snippet is declared?

@trueadm
Copy link
Contributor Author

trueadm commented Jun 29, 2024

I don't follow where exactly, but this is causing additional effects to be created. Using the test in this PR:

export default function App($$anchor) {
  // ...

  var div = $.sibling($.sibling(button, true));

  {
    var div_1 = $.child(div);

    {
      // ...

+     $.template_effect(() => {});
    }

    var div_2 = $.sibling($.sibling(div_1, true));

    {
      // ...

+     $.template_effect(() => {});
    }

+   $.template_effect(() => {});
  }

  $.append($$anchor, fragment);
}

$.delegate(["click"]);

Also, how complicated would it be to only create the block statement in cases where a snippet is declared?

Fixed!

@Rich-Harris Rich-Harris merged commit 434e1ad into main Jun 30, 2024
9 checks passed
@Rich-Harris Rich-Harris deleted the deconflict-snippet branch June 30, 2024 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Svelte 5: Snippets aren't deconflicted
2 participants