Skip to content

fix(migrations): do not migrate next calls in template if not an EventEmitter#58631

Closed
cexbrayat wants to merge 1 commit intoangular:mainfrom
cexbrayat:fix/output-migration-next
Closed

fix(migrations): do not migrate next calls in template if not an EventEmitter#58631
cexbrayat wants to merge 1 commit intoangular:mainfrom
cexbrayat:fix/output-migration-next

Conversation

@cexbrayat
Copy link
Copy Markdown
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.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Fixes #58630

<button (click)="someSubject.next()">Click</button>

was migrated to an .emit call, even if someSubject was not an EventEmitter.

What is the new behavior?

This is no longer the case

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@pullapprove pullapprove bot requested a review from crisbeto November 13, 2024 15:55
@angular-robot angular-robot bot added the area: core Issues related to the framework runtime label Nov 13, 2024
@ngbot ngbot bot added this to the Backlog milestone Nov 13, 2024
@cexbrayat cexbrayat force-pushed the fix/output-migration-next branch from 556c16c to e749d74 Compare November 13, 2024 16:02
@angular-robot angular-robot bot added area: core Issues related to the framework runtime and removed area: core Issues related to the framework runtime labels Nov 13, 2024
@ngbot ngbot bot modified the milestone: Backlog Nov 13, 2024
@cexbrayat cexbrayat changed the title fix(core): do not migrate next calls in template if not an EventEmitter fix(migrations): do not migrate next calls in template if not an EventEmitter Nov 13, 2024
@cexbrayat cexbrayat force-pushed the fix/output-migration-next branch from e749d74 to 7e2780b Compare November 13, 2024 16:38
@angular-robot angular-robot bot added area: migrations Issues related to `ng update`/`ng generate` migrations and removed area: core Issues related to the framework runtime labels Nov 13, 2024
@ngbot ngbot bot modified the milestone: Backlog Nov 13, 2024
Copy link
Copy Markdown
Member

@devversion devversion Nov 13, 2024

Choose a reason for hiding this comment

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

I'm thinking, ideally, we'd filter in the global meta stage, as technically, the call expression could refer to an output from a whole different compilation unit (e.g. tsconfig.json).- probably needs some larger refactoring though.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agreed, this was exactly my observation when scanning through the PR.

The logic needs updating since today we just pile up refactoring for a given property, sometimes assuming that it is an output

Copy link
Copy Markdown
Member

@pkozlowski-opensource pkozlowski-opensource left a comment

Choose a reason for hiding this comment

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

As discussed in the PR comments this fix can be insufficient in some more complex cases. Getting complete fix would require refactoring that will not land before v19.

Given this I think that we should merge it and work on other fixes as a follow-up.

Copy link
Copy Markdown
Member

@devversion devversion left a comment

Choose a reason for hiding this comment

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

LGTM, agreed with Pawel, but maybe have a TODO?

…tEmitter

Fixes angular#58630

```html
<button (click)="someSubject.next()">Click</button>
```

was migrated to an `.emit` call, even if `someSubject` was not an `EventEmitter`.

The issue was the same in host listeners.
@cexbrayat cexbrayat force-pushed the fix/output-migration-next branch from 7e2780b to 345c956 Compare November 15, 2024 11:21
@cexbrayat
Copy link
Copy Markdown
Member Author

@devversion I added a TODO based on your comment 👍

@pkozlowski-opensource pkozlowski-opensource removed the request for review from crisbeto November 15, 2024 11:40
@pkozlowski-opensource pkozlowski-opensource added action: merge The PR is ready for merge by the caretaker target: rc This PR is targeted for the next release-candidate labels Nov 15, 2024
@pkozlowski-opensource
Copy link
Copy Markdown
Member

This PR was merged into the repository by commit 2eb4afe.

The changes were merged into the following branches: main, 19.0.x

pkozlowski-opensource pushed a commit that referenced this pull request Nov 15, 2024
…tEmitter (#58631)

Fixes #58630

```html
<button (click)="someSubject.next()">Click</button>
```

was migrated to an `.emit` call, even if `someSubject` was not an `EventEmitter`.

The issue was the same in host listeners.

PR Close #58631
@angular-automatic-lock-bot
Copy link
Copy Markdown

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 Dec 16, 2024
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 target: rc This PR is targeted for the next release-candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Signal output migration wrongly updates subject.next in templates

4 participants