TF-2533 Add ADR on memory leak js lifecycle

This commit is contained in:
DatDang
2024-04-17 09:31:14 +07:00
committed by Dat H. Pham
parent 205c625c7d
commit d47f255043
@@ -0,0 +1,21 @@
# 44. 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.