@@ -49,6 +49,7 @@ const EditorToolbar = memo(
4949 const { t } = useTranslation ( ) ;
5050 const isAnyLoading = isLoading ;
5151 const [ isLoaderVisible , setIsLoaderVisible ] = useState ( false ) ;
52+ const [ isLoaderMounted , setIsLoaderMounted ] = useState ( false ) ;
5253 const [ disableLoaderTransition , setDisableLoaderTransition ] = useState ( false ) ;
5354 const hideTimeoutRef = useRef < number | null > ( null ) ;
5455 const prevIsLoadingRef = useRef ( isLoading ) ;
@@ -138,6 +139,14 @@ const EditorToolbar = memo(
138139 } ;
139140 } , [ isAnyLoading , isLoading , isLoaderVisible ] ) ;
140141
142+ useEffect ( ( ) => {
143+ if ( isLoaderVisible ) {
144+ setIsLoaderMounted ( true ) ;
145+ } else if ( disableLoaderTransition ) {
146+ setIsLoaderMounted ( false ) ;
147+ }
148+ } , [ isLoaderVisible , disableLoaderTransition ] ) ;
149+
141150 useEffect ( ( ) => {
142151 if ( ! isHistoryVisible ) return ;
143152 const handleClickOutside = ( e : MouseEvent ) => {
@@ -433,8 +442,13 @@ const EditorToolbar = memo(
433442 isLoaderVisible ? 'max-w-4 opacity-100 ml-2' : 'max-w-0 opacity-0 ml-0' ,
434443 disableLoaderTransition ? 'transition-none' : 'transition-all duration-300' ,
435444 ) }
445+ onTransitionEnd = { ( e ) => {
446+ if ( e . propertyName === 'opacity' && ! isLoaderVisible ) {
447+ setIsLoaderMounted ( false ) ;
448+ }
449+ } }
436450 >
437- < Loader2 size = { 12 } className = "text-text-secondary animate-spin" />
451+ { isLoaderMounted && < Loader2 size = { 12 } className = "text-text-secondary animate-spin" /> }
438452 </ div >
439453 </ div >
440454
0 commit comments