From d47f255043c3046dfce7132fa111f20ef4301d68 Mon Sep 17 00:00:00 2001 From: DatDang Date: Wed, 17 Apr 2024 09:31:14 +0700 Subject: [PATCH] TF-2533 Add ADR on memory leak js lifecycle --- .../adr/0045-memory-leak-with-js-lifecycle.md | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 docs/adr/0045-memory-leak-with-js-lifecycle.md diff --git a/docs/adr/0045-memory-leak-with-js-lifecycle.md b/docs/adr/0045-memory-leak-with-js-lifecycle.md new file mode 100644 index 000000000..0ff354bd5 --- /dev/null +++ b/docs/adr/0045-memory-leak-with-js-lifecycle.md @@ -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.