Files
workavia-mail-front/docs/adr/0045-memory-leak-with-js-lifecycle.md
T
2024-05-13 19:12:10 +07:00

22 lines
635 B
Markdown

# 45. Memory leak with js lifecycle
Date: 2024-04-09
## Status
Accepted
## Context
- The js resources are disposed at the end of js lifecycle
- Current listener in used is `beforeunload`. However, `beforeunload` was unstable, resulting in memory leak.
## Decision
- `beforeunload` was replaced by `pagehide`, which is more reliable.
- [`pagehide` documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/pagehide_event)
- [Google Chrome recommendation](https://developer.chrome.com/docs/web-platform/page-lifecycle-api#the_unload_event)
## Consequences
- Memory leak problem in composer on TMail is resolved.