Skip to content

Commit 3167800

Browse files
committed
simplify
1 parent 6ec7f89 commit 3167800

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/index.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,25 +205,22 @@ class OutPortal<C extends Component<any>> extends React.PureComponent<OutPortalP
205205
this.passPropsThroughPortal();
206206
}
207207

208-
componentDidUpdate(prevProps: OutPortalProps<C>) {
208+
componentDidUpdate() {
209209
// We re-mount on update, just in case we were unmounted (e.g. by
210210
// a second OutPortal, which has now been removed)
211211
const node = this.props.node as AnyPortalNode<C>;
212-
const prevNode = prevProps.node
213212

214213
// If we're switching portal nodes, we need to clean up the current one first.
215214
if (this.currentPortalNode && node !== this.currentPortalNode) {
216215
this.currentPortalNode.unmount(this.placeholderNode.current!);
216+
this.currentPortalNode.setPortalProps({} as ComponentProps<C>);
217217
this.currentPortalNode = node;
218218
}
219219

220220
const placeholder = this.placeholderNode.current!;
221221
const parent = placeholder.parentNode!;
222222
node.mount(parent, placeholder);
223223
this.passPropsThroughPortal();
224-
if (prevNode !== node) {
225-
prevNode.setPortalProps({} as ComponentProps<C>);
226-
}
227224
}
228225

229226
componentWillUnmount() {

0 commit comments

Comments
 (0)