-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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(overlay): overlay directives not emitting when detached externally #7950
fix(overlay): overlay directives not emitting when detached externally #7950
Conversation
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, can add merge-ready when ready
@@ -256,7 +256,7 @@ export class ConnectedOverlayDirective implements OnDestroy, OnChanges { | |||
} | |||
|
|||
ngOnChanges(changes: SimpleChanges) { | |||
if (changes['open'] || changes['_deprecatedOpen']) { | |||
if (changes.open || changes._deprecatedOpen) { |
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.
We should stick with the string access here; Closure Compiler may attempt to rename these otherwise
9198234
to
b5672e7
Compare
b5672e7
to
af12c9c
Compare
af12c9c
to
4dac772
Compare
4dac772
to
0f076fd
Compare
0f076fd
to
353df7a
Compare
353df7a
to
3a32a52
Compare
Hi @crisbeto! This PR has merge conflicts due to recent upstream merges. |
1 similar comment
Hi @crisbeto! This PR has merge conflicts due to recent upstream merges. |
3a32a52
to
bcda183
Compare
bcda183
to
35d2f12
Compare
35d2f12
to
7b4adab
Compare
any news? |
7b4adab
to
698ccb9
Compare
Rebased and bumping to a P2, because we're getting new reports about this. |
698ccb9
to
3f025c6
Compare
are there any plans to merge this branch? |
After a full day's deep dive into the test failures, I think I figured out how we can get this merged in. When the Can you add a check so that it will not emit a |
@andrewseguin emitting the |
3f025c6
to
f6ee9da
Compare
The issue boils down to really one component that essentially wraps our overlay directive, so if we can make it work there then I think we're good. What's happening is that this component's view contains an It's there that we seem to have an issue, because that Does it make sense that calling Oh and something really important - it seems this is fine for client code. I'm seeing this fail during test code, and it seems that it's specifically only failing during the |
I believe that the framework will throw an error if you try to call |
That was my initial thinking too, but adding that across the affected components didn't fix anything. For some reason the Since you are sure this logic is sound and what we want, I'll focus on making changes to these tests. While there are a dozen different failing targets, they all use the same wrapper for our overlay, so I suspect I can make adjustments in that wrapper to fix this. |
@crisbeto Please check out crisbeto#10 I managed to distill our internal tests into a single simple case that I can put into our repo. It's a little contrived, but it's because I'm trying to reduce it down as much as possible. This one test represents multiple components with tons of code. Let me know what you think on moving forward to get this to pass. |
Currently the `ConnectedOverlayDirective` only emits the `detach` event when it _thinks_ that the overlay is detached (escape press, backdrop click etc.), but this won't necessarily be correct (e.g. when it was closed by a scroll strategy). These changes refactor the outputs to always be one-to-one with the `OverlayRef` detachments.
f6ee9da
to
99bd29a
Compare
Wow that's one convoluted bug @andrewseguin! What seems to be happening is that the automatic change detection triggers another run when the output emits, even though the related component was destroyed. It looks like the only way forward is to stop emitting the event ourselves once we hit |
#7950) Currently the `ConnectedOverlayDirective` only emits the `detach` event when it _thinks_ that the overlay is detached (escape press, backdrop click etc.), but this won't necessarily be correct (e.g. when it was closed by a scroll strategy). These changes refactor the outputs to always be one-to-one with the `OverlayRef` detachments.
angular#7950) Currently the `ConnectedOverlayDirective` only emits the `detach` event when it _thinks_ that the overlay is detached (escape press, backdrop click etc.), but this won't necessarily be correct (e.g. when it was closed by a scroll strategy). These changes refactor the outputs to always be one-to-one with the `OverlayRef` detachments.
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. |
Currently the
ConnectedOverlayDirective
only emits thedetach
event when it thinks that the overlay is detached (escape press, backdrop click etc.), but this won't necessarily be correct (e.g. when it was closed by a scroll strategy). These changes refactor the outputs to always be one-to-one with theOverlayRef
detachments.Fixes #16779