Skip to content

Comments

fix(core): handle if alias in control flow migration#52181

Closed
cexbrayat wants to merge 1 commit intoangular:mainfrom
cexbrayat:fix/control-flow-migration-as
Closed

fix(core): handle if alias in control flow migration#52181
cexbrayat wants to merge 1 commit intoangular:mainfrom
cexbrayat:fix/control-flow-migration-as

Conversation

@cexbrayat
Copy link
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

This adds the support of if conditions with as clause when migrating to the control flow syntax. It now adds the required semicolon before the as when migrating the template.

What is the new behavior?

Before: @if (user$ | async as user) {
After: @if (user$ | async; as user) {

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@pullapprove pullapprove bot requested a review from crisbeto October 12, 2023 12:51
@cexbrayat
Copy link
Member Author

This is a naive fix, I'm not sure if there is a better way to find if the condition has an asclause, as it is a string. Let me know how this can be improved

@cexbrayat cexbrayat force-pushed the fix/control-flow-migration-as branch 2 times, most recently from e73cc74 to fbb9103 Compare October 12, 2023 13:21
@pkozlowski-opensource pkozlowski-opensource added area: migrations Issues related to `ng update`/`ng generate` migrations core: control flow Issues related to the built-in control flow (@if, @for, @switch) labels Oct 12, 2023
@ngbot ngbot bot modified the milestone: Backlog Oct 12, 2023
@cexbrayat cexbrayat force-pushed the fix/control-flow-migration-as branch from fbb9103 to f9c74ea Compare October 12, 2023 18:19
@cexbrayat cexbrayat force-pushed the fix/control-flow-migration-as branch from f9c74ea to 2b8f1b7 Compare October 12, 2023 18:23
Copy link
Contributor

@jessicajaniuk jessicajaniuk left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@jessicajaniuk jessicajaniuk added the target: rc This PR is targeted for the next release-candidate label Oct 12, 2023
This adds the support of `if ` conditions with `as` clause when migrating to the control flow syntax.
It now adds the required semicolon before the `as` when migrating the template.

Before: `@if (user$ | async as user) {`
After: `@if (user$ | async; as user) {`
@cexbrayat cexbrayat force-pushed the fix/control-flow-migration-as branch from 2b8f1b7 to f20f4e9 Compare October 12, 2023 18:34
@jessicajaniuk jessicajaniuk added the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 12, 2023
@jessicajaniuk jessicajaniuk added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 16, 2023
@pkozlowski-opensource
Copy link
Member

This PR was merged into the repository by commit 2003caf.

pkozlowski-opensource pushed a commit that referenced this pull request Oct 16, 2023
This adds the support of `if ` conditions with `as` clause when migrating to the control flow syntax.
It now adds the required semicolon before the `as` when migrating the template.

Before: `@if (user$ | async as user) {`
After: `@if (user$ | async; as user) {`

PR Close #52181
@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 Nov 16, 2023
ChellappanRajan pushed a commit to ChellappanRajan/angular that referenced this pull request Jan 23, 2024
This adds the support of `if ` conditions with `as` clause when migrating to the control flow syntax.
It now adds the required semicolon before the `as` when migrating the template.

Before: `@if (user$ | async as user) {`
After: `@if (user$ | async; as user) {`

PR Close angular#52181
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: migrations Issues related to `ng update`/`ng generate` migrations core: control flow Issues related to the built-in control flow (@if, @for, @switch) target: rc This PR is targeted for the next release-candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants