fix: bind:group incorrectly considers other groups for nested data #10364
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.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 theobject
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 theComponentAnalysis
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.