-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
AccordionTab throwing ViewDestroyedError during unit testing #8044
Comments
Same problem here (same error coming from onToggleDone()), this only shows up when in debug mode. |
Hello! Details: Thanks |
Hi, |
Like I said in the initial report, I'm not sure how to provide an example because I only see this during unit testing, where a test completes and the component is destroyed before the Accordion finishes animating. I think my initial description tells the whole story though. If you just look at the code I linked to above you can clearly see the problem. There's no check in place to make sure the component hasn't been destroyed before it runs I think
|
@yigitfindikli same comment as @brian428 can't provide an example as well; what I could understand is that a singular test ran with Fit (even if is obsolete) is not throwing errors, but if I run more tests together, some of these are throwing errors. |
Hello there, Thanks |
fixed #8044 AccordionTab throwing ViewDestroyedError during unit testing
I'm submitting a ... (check one with "x")
Plunkr Case (Bug Reports)
Unfortunately, I'm not sure how to create a demo of the problem because the problem only manifests during unit testing. However, the source of the problem is very straightforward:
done()
) before the Accordion finishes animating, aViewDestroyedError: Attempt to use a destroyed view: detectChanges
is thrown.onToggleDone()
. This in turn calls the animation setter, which tries to run change detection (https://github.com/primefaces/primeng/blame/master/src/app/components/accordion/accordion.ts#L77).ViewDestroyedError
is thrown.It doesn't cause the spec to fail, but it does create a ton of these errors in the log. Perhaps just add an internal property for
isDestroyed
that is set to true inonDestroy()
, and then check to make sure it is still false before callingdetectChanges()
?The text was updated successfully, but these errors were encountered: