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 #13034

Closed
jacks-bush opened this issue May 12, 2023 · 3 comments · Fixed by #13035 or #13756
Closed

p-confirmPopup errors when setTimeout runs after onContainerDestroy #13034

jacks-bush opened this issue May 12, 2023 · 3 comments · Fixed by #13035 or #13756
Assignees
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

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.

The most common case we are seeing in our app is that this.confirmation is null when bindScrollListener() is called from the setTimeout.

Environment

Versions below.

Reproducer

No response

Angular version

14.2.5

PrimeNG version

14.1.2

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 bindScrollListener() 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 May 12, 2023
jacks-bush pushed a commit to jacks-bush/primeng-fix-confirm-popup that referenced this issue May 12, 2023
…nds up running after the popup has been closed, and the confirmation on the confirmpopup component has already been set to null. Added null checks to the confirmation property.

Fixes primefaces#13034
@cetincakiroglu cetincakiroglu self-assigned this May 16, 2023
@cetincakiroglu cetincakiroglu added this to the 16.0.0 milestone May 16, 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 May 16, 2023
@cetincakiroglu cetincakiroglu modified the milestones: 16.0.0-rc.2, 16.0.0 May 19, 2023
jacks-bush pushed a commit to jacks-bush/primeng-fix-confirm-popup that referenced this issue Sep 26, 2023
@jacks-bush
Copy link
Contributor Author

@cetincakiroglu,

When I updated our application to use the 16.0.1 release that included the #13035 pull request, I found another issue that was not happening when I first tested my fixes locally.
I made a new pull request #13756 to fix the new error. Since it's the same underlying issue I just kept this bug report. Let me know if I should make a new one instead!

@cetincakiroglu
Copy link
Contributor

Hi @jacks-bush,

Could you please open an issue for that too so I can add it to the milestone

@jacks-bush
Copy link
Contributor Author

@cetincakiroglu,
I made #13761 and linked it to the new pull request and this issue.

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