Skip to content

fix: bind:group incorrectly considers other groups for nested data #10364

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

Closed
wants to merge 2 commits into from

Conversation

ciscoheat
Copy link

Before submitting the PR, please make sure you do the following

  • 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
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Description

This PR is a start of fixing #9947. The failing test shows that binding groups aren't properly being separated when binding to nested data, like $order.scoops in the example. It will be intermingled with the $order.flavours group.

Details

In src\compiler\phases\2-analyze\index.js around line 1024, a binding is referenced based on the left-most identifier of a member expression or identifier (by way of the object function).

This makes the $order.scoops and the $order.flavours reference to the same group binding, $order.

Changing the id of the binding to the whole expression doesn't work, as that binding id doesn't exist in context.state.scope.

Also, the binding_groups of the ComponentAnalysis interface is a Map that only accepts one group per binding, so it seems like you cannot add different groups like that, based on the same binding.

If it's a relatively simple fix, with some pointers in the right direction, I can keep working on it.

Copy link

changeset-bot bot commented Feb 1, 2024

⚠️ No Changeset found

Latest commit: e75b2a1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@dummdidumm
Copy link
Member

Thanks for the test. I'm currently working on fixing #10345 which might be a duplicate of your issue after all, so hopefully we got this working soon.

@dummdidumm
Copy link
Member

Closing in favor of #10368 - thanks for the test!

@dummdidumm dummdidumm closed this Feb 1, 2024
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.

2 participants