Skip to content

Commit

Permalink
Hotfix/portal memory leak (#26435)
Browse files Browse the repository at this point in the history
* clean virtual parent reference

* changelog

* reuse setVirtual and remove cleanVirtualParent
  • Loading branch information
arthurd-micro authored Jan 23, 2023
1 parent 294d8a7 commit f644027
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "clean up parent reference to avoid memory leaks",
"packageName": "@fluentui/react-portal",
"email": "arthurd@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ export const usePortal_unstable = (props: PortalProps): PortalState => {
if (state.virtualParentRootRef.current && state.mountNode) {
setVirtualParent(state.mountNode, state.virtualParentRootRef.current);
}
return () => {
if (state.mountNode) {setVirtualParent(state.mountNode, undefined);}
};
}, [state.virtualParentRootRef, state.mountNode]);

return state;
Expand Down

0 comments on commit f644027

Please sign in to comment.