@@ -55,8 +55,8 @@ export const createPortalNode = <C extends Component<any>>(): PortalNode<C> => {
5555 }
5656 portalNode . unmount ( ) ;
5757
58- // To support SVG and other non-html elements, the portalNode's element needs to created with
59- // the correct namespace.
58+ // To support SVG and other non-html elements, the portalNode's element needs to be
59+ // created with the correct namespace.
6060 if ( ! portalNode . element || portalNode . element . tagName !== newParent . tagName ) {
6161 if ( newParent instanceof SVGElement ) {
6262 portalNode . element = document . createElementNS ( SVG_NAMESPACE , newParent . tagName ) ;
@@ -157,10 +157,7 @@ export class OutPortal<C extends Component<any>> extends React.PureComponent<Out
157157 this . passPropsThroughPortal ( ) ;
158158 }
159159
160- passPropsThroughPortal ( ) {
161- const propsForTarget = Object . assign ( { } , this . props , { node : undefined } ) ;
162- this . props . node . setPortalProps ( propsForTarget ) ;
163-
160+ maybeTriggerOnReady ( ) {
164161 if ( this . props . node . onReady ) {
165162 // There's an InPortal which is waiting on this OutPortal:
166163 // rerender it now that the OutPortal and portalNode are ready
@@ -169,6 +166,11 @@ export class OutPortal<C extends Component<any>> extends React.PureComponent<Out
169166 }
170167 }
171168
169+ passPropsThroughPortal ( ) {
170+ const propsForTarget = Object . assign ( { } , this . props , { node : undefined } ) ;
171+ this . props . node . setPortalProps ( propsForTarget ) ;
172+ }
173+
172174 componentDidMount ( ) {
173175 const node = this . props . node as PortalNode < C > ;
174176 this . currentPortalNode = node ;
@@ -177,6 +179,7 @@ export class OutPortal<C extends Component<any>> extends React.PureComponent<Out
177179 const parent = placeholder . parentNode ! ;
178180 node . mount ( parent , placeholder ) ;
179181 this . passPropsThroughPortal ( ) ;
182+ this . maybeTriggerOnReady ( ) ;
180183 }
181184
182185 componentDidUpdate ( ) {
@@ -194,6 +197,7 @@ export class OutPortal<C extends Component<any>> extends React.PureComponent<Out
194197 const parent = placeholder . parentNode ! ;
195198 node . mount ( parent , placeholder ) ;
196199 this . passPropsThroughPortal ( ) ;
200+ this . maybeTriggerOnReady ( ) ;
197201 }
198202
199203 componentWillUnmount ( ) {
0 commit comments