Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(Popover): Upgrade Popover to Antd5 #31973

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

alexandrusoare
Copy link
Contributor

@alexandrusoare alexandrusoare commented Jan 23, 2025

SUMMARY

Upgrading Popover component to Antd5.

Fixes #31953

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

BEFORE

image

AFTER

image

BEFORE

image

AFTER

image

BEFORE

image

AFTER

image

BEFORE

image

AFTER

image

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Copy link

korbit-ai bot commented Jan 23, 2025

Based on your review schedule, I'll hold off on reviewing this PR until it's marked as ready for review. If you'd like me to take a look now, comment /korbit-review.

Your admin can change your review schedule in the Korbit Console

Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Fix Detected
Functionality Filter popover z-index issue in full-size mode ▹ view
Functionality Redundant Z-Index Configuration ▹ view
Functionality Unreliable Header Access ▹ view

Need a new review? Comment /korbit-review on this PR and I'll review your latest changes.

Korbit Guide: Usage and Customization

Interacting with Korbit

  • You can manually ask Korbit to review your PR using the /korbit-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command in any comment on your PR.
  • Chat with Korbit on issues we post by tagging @korbit-ai in your reply.
  • Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.

Customizing Korbit

  • Check out our docs on how you can make Korbit work best for you and your team.
  • Customize Korbit for your organization through the Korbit Console.

Feedback and Support

@geido geido added hold! On hold preset:bounty Issues that have been selected by Preset and have a bounty attached. labels Jan 27, 2025
// for now we're just redirecting
export { Popover as default } from './Popover';
export interface PopoverProps extends AntdPopoverProps {
forceRender?: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

What is this for? I don't see forceRender exposed in the Popover props of Ant Design. Will this have any effect?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was being used before, I just combined the Popover.tsx file with the index.tsx file -> https://github.com/apache/superset/pull/31973/files/18ef69e7e88cc0389c4dd991050e176988acb9e8#diff-575bb0af856e1f113959bcf0ec737a412cb23b3b5ed154012d993d5be95da187
And the forceRender prop is being used in some places, here's 1 for example: superset/superset-frontend/src/components/DropdownContainer/index.tsx

Copy link
Member

@geido geido Feb 3, 2025

Choose a reason for hiding this comment

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

I am not sure this answers my question. If forceRender is not an option that Popover accepts in Ant Design, what is the use of it? Is this actually doing anything? Can you confirm that, please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The forceRender option ensures that the Popover’s content is rendered in the DOM even when the Popover is not opened. I verified that it behaves as expected, which confirms that it works even though it isn’t an official prop in Ant Design.

@EnxDev EnxDev self-requested a review January 27, 2025 22:33
@EnxDev
Copy link
Contributor

EnxDev commented Jan 27, 2025

@alexandrusoare regarding Popover.stories.tsx, could you add the default values for TRIGGERS i think 'click, 'top' for PLACEMENTS, and include a state that changes based on the selected triggers?

For example, when you click the button, the popover should open, or it should change when the selected trigger is changed, for make it interactive.

Recording.2025-01-27.234116.mp4

Copy link
Contributor

@msyavuz msyavuz left a comment

Choose a reason for hiding this comment

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

Looks good, minor gripe for me is default exports but i've seen it used in other places so i think it's fine

@@ -181,11 +181,13 @@ const DropdownContainer = forwardRef(
);

useLayoutEffect(() => {
if (popoverVisible) {
Copy link
Member

Choose a reason for hiding this comment

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

should we add it to the dependency array?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I don't think so, I added this statement because of a visual bug that was happening in certain cases. And I think that we don't need to recalculate the size when popover is closed .

@geido
Copy link
Member

geido commented Feb 3, 2025

On top of the comments I have unresolved above, can you please check if this is a newly introduced bug? It seems the Popover would not open in the right position, making it hard to interact with when within "More filters" in horizontal mode.

Screenshot 2025-02-03 at 18 51 04

overlayStyle={{
width: '240px',
padding: 0,
borderRadius: theme.borderRadius,
Copy link
Member

Choose a reason for hiding this comment

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

Can we rely on the default borders of Ant Design here? Same with paddings?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think we can rely on the defaults here

Without Padding:
image
With Padding:
image
Without Border:
image
With Border:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change:frontend Requires changing the frontend frontend:refactor:antd5 hold! On hold packages preset:bounty Issues that have been selected by Preset and have a bounty attached. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ant Design 5: Upgrade Popover component
7 participants