File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ export interface UniqueShowOptions {
35
35
}
36
36
37
37
export interface UniqueContextProps {
38
- show : ( options : UniqueShowOptions ) => void ;
38
+ show : ( options : UniqueShowOptions , isOpen : ( ) => boolean ) => void ;
39
39
hide : ( delay : number ) => void ;
40
40
}
41
41
Original file line number Diff line number Diff line change @@ -309,6 +309,9 @@ export function generateTrigger(
309
309
}
310
310
} ) ;
311
311
312
+ // Support ref
313
+ const isOpen = useEvent ( ( ) => mergedOpen ) ;
314
+
312
315
useLayoutEffect ( ( ) => {
313
316
setInternalOpen ( popupVisible || false ) ;
314
317
} , [ popupVisible ] ) ;
@@ -347,9 +350,7 @@ export function generateTrigger(
347
350
! parentContext
348
351
) {
349
352
if ( mergedOpen ) {
350
- Promise . resolve ( ) . then ( ( ) => {
351
- uniqueContext . show ( getUniqueOptions ( 0 ) ) ;
352
- } ) ;
353
+ uniqueContext . show ( getUniqueOptions ( 0 ) , isOpen ) ;
353
354
} else {
354
355
uniqueContext . hide ( 0 ) ;
355
356
}
@@ -395,7 +396,7 @@ export function generateTrigger(
395
396
// If there is a parentContext, don't call uniqueContext methods
396
397
if ( uniqueContext && unique && openUncontrolled && ! parentContext ) {
397
398
if ( nextOpen ) {
398
- uniqueContext . show ( getUniqueOptions ( delay ) ) ;
399
+ uniqueContext . show ( getUniqueOptions ( delay ) , isOpen ) ;
399
400
} else {
400
401
uniqueContext . hide ( delay ) ;
401
402
}
You can’t perform that action at this time.
0 commit comments