Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/UniqueProvider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ const UniqueProvider = ({ children }: UniqueProviderProps) => {
arrow={options.arrow}
motion={options.popupMotion}
maskMotion={options.maskMotion}
getPopupContainer={options.getPopupContainer}
// getPopupContainer={options.getPopupContainer}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This line is commented out. If the getPopupContainer prop is no longer intended to be supported by UniqueProvider, it's better to remove this line entirely rather than commenting it out. This practice helps to avoid dead code and makes the codebase cleaner and easier to maintain.

If this is an intentional removal of functionality, you might also consider removing getPopupContainer from the UniqueShowOptions interface in src/context.ts to maintain consistency across the API.

>
<FloatBg
prefixCls={prefixCls}
Expand Down
14 changes: 11 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,15 @@ export function generateTrigger(

// Handle controlled state changes for UniqueProvider
// Only sync to UniqueProvider when it's controlled mode
// If there is a parentContext, don't call uniqueContext methods
useLayoutEffect(() => {
if (uniqueContext && unique && targetEle && !openUncontrolled) {
if (
uniqueContext &&
unique &&
targetEle &&
!openUncontrolled &&
!parentContext
) {
if (mergedOpen) {
Promise.resolve().then(() => {
uniqueContext.show(getUniqueOptions(0));
Expand All @@ -346,7 +353,7 @@ export function generateTrigger(
uniqueContext.hide(0);
}
}
}, [mergedOpen]);
}, [mergedOpen, targetEle]);

const openRef = React.useRef(mergedOpen);
openRef.current = mergedOpen;
Expand Down Expand Up @@ -384,7 +391,8 @@ export function generateTrigger(
}

// If UniqueContext exists and not controlled, pass delay to Provider instead of handling it internally
if (uniqueContext && unique && openUncontrolled) {
// If there is a parentContext, don't call uniqueContext methods
if (uniqueContext && unique && openUncontrolled && !parentContext) {
if (nextOpen) {
uniqueContext.show(getUniqueOptions(delay));
} else {
Expand Down
Loading