If we start the Viewer, but a navigation happens in between, we have the following problem.
This would be not such a problem if it would not log it only once, but it seems there is some kind of loop, and we are getting a lot of those errors. Also, it impacts the browser performance as well.
The following message also gets printed, but I would not know how we can avoid that leak.
This seems to happen from the Version 7.90.0 onwards. With the Version 7.89.0 we would get the following error:
But this error gets logged only once, and we experienced no performance issues.
Will there be fix in some upcoming versions, or how could we tackle this issue?
Steps to reproduce:
- Start up a viewer instance
- Quickly navigate back
- Wait for errors in console
Update
We already call the folllowing functions on the ngDestroyHook:
- viewer.tearDown()
- viewer.current?.uninitialize()
- this.viewer.finish()
- Autodesk.Viewing.shutdown();
2
Answers
You need to destroy the
viewer
instance, once the component gets unmounted, inside thengOnDestroy
hook.It did not matter which version I used (v7.89 or v7.97 – the latest one at the moment) I got similar results in my very simple vanilla html page.
If I remove the Viewer component from the DOM while it’s loading a model I get:
If I set the Viewer size to 0 while it’s loading a model I get:
(if I call
viewer.impl.resize(0, 0)
more than once the same error gets into an endless loop)Here is the html page I used for testing: https://github.com/adamenagy/Container/blob/master/revit-reload.html
If these do not help narrow down the issue on your side then the best would be if you could provide a minimal (as small and simple as possible) sample for us to use to reproduce the issue on our side.