Skip to content

Commit 0eca495

Browse files
authored
Merge pull request #38 from adri1wald/feature/reset-portal-props
reset InPortal nodeProps on OutPortal node update or unmount
2 parents 3426281 + 3167800 commit 0eca495

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ class OutPortal<C extends Component<any>> extends React.PureComponent<OutPortalP
213213
// If we're switching portal nodes, we need to clean up the current one first.
214214
if (this.currentPortalNode && node !== this.currentPortalNode) {
215215
this.currentPortalNode.unmount(this.placeholderNode.current!);
216+
this.currentPortalNode.setPortalProps({} as ComponentProps<C>);
216217
this.currentPortalNode = node;
217218
}
218219

@@ -225,6 +226,7 @@ class OutPortal<C extends Component<any>> extends React.PureComponent<OutPortalP
225226
componentWillUnmount() {
226227
const node = this.props.node as AnyPortalNode<C>;
227228
node.unmount(this.placeholderNode.current!);
229+
node.setPortalProps({} as ComponentProps<C>);
228230
}
229231

230232
render() {

0 commit comments

Comments
 (0)