Skip to content
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

fix(core): handle multiple i18n attributes with expression bindings #41882

Conversation

petebacondarwin
Copy link
Member

When there are multiple attributes that are marked for i18n translation,
which contain expression bindings, we were generating i18n update op-codes
that did not accurately map to the correct value to be bound in the lView.
Each attribute's bindings were relative to the start of the lView first
attributes values rather than to their own.

This fix passes the current binding index to generateBindingUpdateOpCodes()
when processing i18n attributes to account for this.

Fixes #41869

@google-cla google-cla bot added the cla: yes label Apr 29, 2021
@pullapprove pullapprove bot requested a review from atscott April 29, 2021 15:46
@petebacondarwin petebacondarwin added action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime core: directive matching labels Apr 29, 2021
@ngbot ngbot bot modified the milestone: Backlog Apr 29, 2021
@petebacondarwin petebacondarwin added the target: patch This PR is targeted for the next patch release label Apr 29, 2021
@petebacondarwin petebacondarwin requested review from mhevery and AndrewKushnir and removed request for atscott April 29, 2021 15:47
@petebacondarwin petebacondarwin added the action: presubmit The PR is in need of a google3 presubmit label Apr 29, 2021
Copy link
Contributor

@mhevery mhevery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with cleanup

packages/core/src/render3/i18n/i18n_parse.ts Outdated Show resolved Hide resolved
@mhevery mhevery added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Apr 29, 2021
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petebacondarwin thanks for fixing the issue and adding docs with perf assessment 👍

One comment that I have is that I'd like to propose adding a new test (or update an existing one to repro the issue) in packages/core/test/acceptance/i18n_spec.ts file as well, so we have better coverage there.

@AndrewKushnir AndrewKushnir removed the action: review The PR is still awaiting reviews from at least one requested reviewer label Apr 29, 2021
@petebacondarwin petebacondarwin removed the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Apr 29, 2021
@petebacondarwin
Copy link
Member Author

One comment that I have is that I'd like to propose adding a new test (or update an existing one to repro the issue) in packages/core/test/acceptance/i18n_spec.ts file as well, so we have better coverage there.

@AndrewKushnir - I have added the acceptance test and now we are go for a presubmit

@AndrewKushnir
Copy link
Contributor

Presubmit.

@AndrewKushnir AndrewKushnir removed the action: presubmit The PR is in need of a google3 presubmit label Apr 30, 2021
@AndrewKushnir
Copy link
Contributor

FYI presubmits are successful for the changes in this PR.

@AndrewKushnir AndrewKushnir added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Apr 30, 2021
When there are multiple attributes that are marked for i18n translation,
which contain expression bindings, we were generating i18n update op-codes
that did not accurately map to the correct value to be bound in the lView.
Each attribute's bindings were relative to the start of the lView first
attributes values rather than to their own.

This fix passes the current binding index to `generateBindingUpdateOpCodes()`
when processing i18n attributes to account for this.

Fixes angular#41869
@petebacondarwin petebacondarwin added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Apr 30, 2021
@petebacondarwin
Copy link
Member Author

I rebased to clear the conflict. Only change was in a test file. So a new presubmit may not be necessary.

@mhevery mhevery added target: rc This PR is targeted for the next release-candidate and removed target: patch This PR is targeted for the next patch release labels Apr 30, 2021
@mhevery mhevery closed this in 9b4b281 Apr 30, 2021
mhevery pushed a commit that referenced this pull request Apr 30, 2021
…41882)

When there are multiple attributes that are marked for i18n translation,
which contain expression bindings, we were generating i18n update op-codes
that did not accurately map to the correct value to be bound in the lView.
Each attribute's bindings were relative to the start of the lView first
attributes values rather than to their own.

This fix passes the current binding index to `generateBindingUpdateOpCodes()`
when processing i18n attributes to account for this.

Fixes #41869

PR Close #41882
@petebacondarwin petebacondarwin deleted the fw-i18n-opcodes-issue-41869 branch May 1, 2021 14:04
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime cla: yes core: directive matching target: rc This PR is targeted for the next release-candidate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

i18n tagged sub component inputs are bleeding interpolation values
4 participants