File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -895,11 +895,13 @@ export default function generateSelector<
895
895
const [ containerWidth , setContainerWidth ] = React . useState ( null ) ;
896
896
897
897
useLayoutEffect ( ( ) => {
898
- const newWidth = Math . ceil ( containerRef . current . offsetWidth ) ;
899
- if ( containerWidth !== newWidth ) {
900
- setContainerWidth ( newWidth ) ;
898
+ if ( triggerOpen ) {
899
+ const newWidth = Math . ceil ( containerRef . current . offsetWidth ) ;
900
+ if ( containerWidth !== newWidth ) {
901
+ setContainerWidth ( newWidth ) ;
902
+ }
901
903
}
902
- } ) ;
904
+ } , [ triggerOpen ] ) ;
903
905
904
906
const popupNode = (
905
907
< OptionList
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ exports[`Select.Tags OptGroup renders correctly 1`] = `
78
78
<div >
79
79
<div
80
80
class = " rc-select-dropdown"
81
- style = " width: 0px; opacity: 0 ;"
81
+ style = " opacity: 0; width: 0px ;"
82
82
>
83
83
<div >
84
84
<div
You can’t perform that action at this time.
0 commit comments