File tree Expand file tree Collapse file tree 1 file changed +1
-12
lines changed Expand file tree Collapse file tree 1 file changed +1
-12
lines changed Original file line number Diff line number Diff line change @@ -156,9 +156,6 @@ export function generateTrigger(
156
156
157
157
triggerRef = React . createRef < React . ReactInstance > ( ) ;
158
158
159
- // ensure `getContainer` will be called only once
160
- portalContainer ?: HTMLElement ;
161
-
162
159
attachId ?: number ;
163
160
164
161
clickOutsideHandler : CommonEventHandler ;
@@ -861,18 +858,10 @@ export function generateTrigger(
861
858
let portal : React . ReactElement ;
862
859
// prevent unmounting after it's rendered
863
860
if ( popupVisible || this . popupRef . current || forceRender ) {
864
- if ( ! this . portalContainer ) {
865
- // In React.StrictMode component will call render multiple time in first mount.
866
- // When you want to refactor with FC, useRef will also init multiple time and
867
- // point to different useRef instance which will create multiple element
868
- // (This multiple render will not trigger effect so you can not clean up this
869
- // in effect). But this is safe with class component since it always point to same class instance.
870
- this . portalContainer = this . getContainer ( ) ;
871
- }
872
861
portal = (
873
862
< PortalComponent
874
863
key = "portal"
875
- getContainer = { ( ) => this . portalContainer }
864
+ getContainer = { this . getContainer }
876
865
didUpdate = { this . handlePortalUpdate }
877
866
>
878
867
{ this . getComponent ( ) }
You can’t perform that action at this time.
0 commit comments