Skip to content

Commit 14791f3

Browse files
arturovtAndrewKushnir
authored andcommitted
fix(core): cleanup stash listener when app is destroyed (#59598)
In this commit, we clean up the reference to the function set by the environment initializer, as the function closure may capture injected elements and prevent them from being properly garbage collected. PR Close #59598
1 parent 35e5bbb commit 14791f3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/core/src/hydration/event_replay.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ export function withEventReplay(): Provider[] {
140140
// no elements are still captured in the global list and are not prevented
141141
// from being garbage collected.
142142
clearAppScopedEarlyEventContract(appId);
143+
// Clean up the reference to the function set by the environment initializer,
144+
// as the function closure may capture injected elements and prevent them
145+
// from being properly garbage collected.
146+
setStashFn(() => {});
143147
}
144148
});
145149

0 commit comments

Comments
 (0)