iTwin / viewer

Monorepo that contains the iTwin Viewer npm packages and their related packages
MIT License
25 stars 16 forks source link

Add IModelApp.shutdown on page unload events #312

Closed hl662 closed 7 months ago

hl662 commented 7 months ago

Backlog issue: https://github.com/iTwin/itwinjs-backlog/issues/1065 To address a memory leak issue caused by frequent page refreshes, an explicit IModelApp.shutddown() was added inside of a 'beforeunload' event listener. Page refreshes, as well as navigation away from a react component, do not count as a componentWillUnmount() react lifecycle, instead it is a part of a 'beforeunload' window DOM event.

aruniverse commented 7 months ago

actually can you add this to desktop viewer as well?

hl662 commented 7 months ago

Added to desktop-viewer-react, tested using desktop viewer-test with a local .bim file (electron lets you do window reloads). Same behavior as the browser version so no differences with the implementation in web-viewer-react