-
Notifications
You must be signed in to change notification settings - Fork 26.3k
fix(migrations): do not migrate next calls in template if not an EventEmitter #58631
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
Conversation
556c16c
to
e749d74
Compare
e749d74
to
7e2780b
Compare
@@ -278,7 +278,7 @@ export class OutputMigration extends TsurgeFunnelMigration< | |||
// detect .next usages that should be migrated to .emit in template and host binding expressions | |||
if (ref.kind === ReferenceKind.InTemplate) { | |||
const callExpr = checkNonTsReferenceCallsField(ref, 'next'); | |||
if (callExpr !== null) { | |||
if (callExpr !== null && outputFieldReplacements[ref.target.key] !== undefined) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this 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.
There was a problem hiding this 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.
7e2780b
to
345c956
Compare
@devversion I added a TODO based on your comment 👍 |
This PR was merged into the repository by commit 2eb4afe. The changes were merged into the following branches: main, 19.0.x |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Fixes #58630
was migrated to an
.emit
call, even ifsomeSubject
was not anEventEmitter
.What is the new behavior?
This is no longer the case
Does this PR introduce a breaking change?
Other information