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

p-confirmPopup errors when setTimeout runs after onContainerDestroy #13761

Closed
jacks-bush opened this issue Sep 27, 2023 · 0 comments · Fixed by #13756
Closed

p-confirmPopup errors when setTimeout runs after onContainerDestroy #13761

jacks-bush opened this issue Sep 27, 2023 · 0 comments · Fixed by #13756
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@jacks-bush
Copy link
Contributor

Describe the bug

This is a follow-up issue from #13034.

In the p-confirmPopup, there are a few listeners that get set up in a setTimeout that gets called when the popup is first opened. If, for some reason, that setTimeout does not get called before the popup is closed, which sets this.confirmation = null on the component, the component throws a bunch of errors in places where it is expecting this.confirmation to be defined.

In this case, onAnimationStart() calls align(), which accesses this.confirmation?.target and expects it to be defined.

Environment

Versions below

Reproducer

No response

Angular version

16.2.1

PrimeNG version

16.0.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

16.14.0

Browser(s)

Chrome and Firefox, didn't test the others

Steps to reproduce the behavior

I was unable to reproduce this in a stackblitz, but I can reproduce in our app consistently. What happens is as follows:

  1. User resizes a chart which causes it to redraw.
  2. User clicks on another chart, hits delete and the confirm popup comes up.
  3. User hits enter and the confirm popup disappears.
  4. When the first chart finishes redrawing, an error is thrown in DomHandler.absolutePosition(), which is called from the align() method in the confirm popup component, because this.confirmation is null.

Expected behavior

No response

@jacks-bush jacks-bush added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Sep 27, 2023
@cetincakiroglu cetincakiroglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Sep 27, 2023
@cetincakiroglu cetincakiroglu added this to the 16.4.1 milestone Sep 27, 2023
cetincakiroglu added a commit that referenced this issue Sep 27, 2023
Fixes #13761. Breaking out early in the align() method when the confirmation is null.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
2 participants