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.