[BUGFIX beta] Keep rest positional parameters when nesting contextual components if needed. #13764
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.
Steps to reproduce the bug before this patch:
link-to
).(component "link-to" "index")
).{{component (component "link-to" "index")}}
)."index"
at all.What was causing it?
Because of how positional parameters work (both in components and contextual
components), it is needed to treat them at each level and then merge them.
Sadly, this was causing to overwrite the rest positional parameters because
when no parameters are passed, the attribute get an empty array nonetheless.
In the example above, assuming
LinkToComponent.positionalParams === 'params'
:2
gets its positional parameters processed andreceives the following named parameters
{ params: ['index'] }
.{{component}}
processes its own parameters getting{ params: [] }
. Then it merges in anew EmptyObject()
these attributeson top of the ones in the contextual component. (See what I did there?
I used the JS keyword
new
as an adjective! He he. Don't judge me, it ispretty late in here)
Solving the issue
This PR changes the implementation of
mergeInNewHash
to keep the originalpositional parameters if the new ones are empty and the positional parameter is
of type rest.
Fixes #13742