Skip to content

Commit 6f93146

Browse files
authored
chore: not handle nest usage case (#569)
* chore: ignore nest case * chore: ignore if nest in * chore: not support getPopupContainer
1 parent 945cf85 commit 6f93146

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/UniqueProvider/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ const UniqueProvider = ({ children }: UniqueProviderProps) => {
173173
arrow={options.arrow}
174174
motion={options.popupMotion}
175175
maskMotion={options.maskMotion}
176-
getPopupContainer={options.getPopupContainer}
176+
// getPopupContainer={options.getPopupContainer}
177177
>
178178
<FloatBg
179179
prefixCls={prefixCls}

src/index.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,15 @@ export function generateTrigger(
336336

337337
// Handle controlled state changes for UniqueProvider
338338
// Only sync to UniqueProvider when it's controlled mode
339+
// If there is a parentContext, don't call uniqueContext methods
339340
useLayoutEffect(() => {
340-
if (uniqueContext && unique && targetEle && !openUncontrolled) {
341+
if (
342+
uniqueContext &&
343+
unique &&
344+
targetEle &&
345+
!openUncontrolled &&
346+
!parentContext
347+
) {
341348
if (mergedOpen) {
342349
Promise.resolve().then(() => {
343350
uniqueContext.show(getUniqueOptions(0));
@@ -346,7 +353,7 @@ export function generateTrigger(
346353
uniqueContext.hide(0);
347354
}
348355
}
349-
}, [mergedOpen]);
356+
}, [mergedOpen, targetEle]);
350357

351358
const openRef = React.useRef(mergedOpen);
352359
openRef.current = mergedOpen;
@@ -384,7 +391,8 @@ export function generateTrigger(
384391
}
385392

386393
// If UniqueContext exists and not controlled, pass delay to Provider instead of handling it internally
387-
if (uniqueContext && unique && openUncontrolled) {
394+
// If there is a parentContext, don't call uniqueContext methods
395+
if (uniqueContext && unique && openUncontrolled && !parentContext) {
388396
if (nextOpen) {
389397
uniqueContext.show(getUniqueOptions(delay));
390398
} else {

0 commit comments

Comments
 (0)