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

chore: Upgrade AG Grid to use tree shaking #32334

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

Conversation

kgabryje
Copy link
Member

@kgabryje kgabryje commented Feb 20, 2025

SUMMARY

Upgrade AG Grid to version 33. This version improved modules architecture, which lets us specify exactly which parts of the library we use and tree-shake the rest, thus improving the bundle size.
Additionally, I wrapped some props passed to AG Grid in useMemo to avoid rerenders

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

No visual changes

TESTING INSTRUCTIONS

The AG Grid table in SQL Lab should work like before

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

@dosubot dosubot bot added change:frontend Requires changing the frontend sqllab Namespace | Anything related to the SQL Lab labels Feb 20, 2025
@kgabryje
Copy link
Member Author

@justinpark could you please verify if I included all modules that we use in the table in SQL Lab? There's a tool that helps selecting the correct modules here

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.

I've completed my review and didn't find any issues.

Files scanned
File Path Reviewed
superset-frontend/src/setup/setupAGGridModules.ts
superset-frontend/src/views/App.tsx
superset-frontend/src/components/GridTable/index.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

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.

Current Korbit Configuration

General Settings
Setting Value
Review Schedule Automatic excluding drafts
Max Issue Count 10
Automatic PR Descriptions
Issue Categories
Category Enabled
Documentation
Logging
Error Handling
Readability
Design
Performance
Security
Functionality

Feedback and Support

Note

Korbit Pro is free for open source projects 🎉

Looking to add Korbit to your team? Get started with a free 2 week trial here

Copy link
Contributor

@kgabryje Processing your ephemeral environment request here. Action: up.

Copy link
Contributor

@kgabryje Ephemeral environment spinning up at http://52.12.1.165:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup.

Copy link
Contributor

@kgabryje Processing your ephemeral environment request here. Action: up.

@apache apache deleted a comment from github-actions bot Feb 21, 2025
@apache apache deleted a comment from github-actions bot Feb 21, 2025
Copy link
Contributor

@kgabryje Ephemeral environment spinning up at http://52.12.1.165:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup.

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

LGTM

@michael-s-molina
Copy link
Member

@kgabryje I pinged @justinpark and he'll take a look. Please don't merge it just yet 😉

@@ -363,7 +368,7 @@ describe('ResultSet', () => {
);
});
const { getByRole } = setup(mockedProps, mockStore(initialState));
expect(getByRole('treegrid')).toBeInTheDocument();
expect(getByRole('grid')).toBeInTheDocument();
Copy link
Member Author

Choose a reason for hiding this comment

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

For some reason, in jest runtime, the ag grid root had a role "grid", not "treegrid"

Copy link
Member

@justinpark justinpark left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for upgrade

Copy link
Member

@justinpark justinpark left a comment

Choose a reason for hiding this comment

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

wait. it looks like the header menu has gone in this version. Could you check what is missing?

RowApiModule,
CellApiModule,
RenderApiModule,
ClientSideRowModelModule,
Copy link
Member

Choose a reason for hiding this comment

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

Could you check if there's an api for column header?

Copy link
Member Author

Choose a reason for hiding this comment

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

There isn't, the closest thing is ColumnApiModule which we include here

Copy link
Member

Choose a reason for hiding this comment

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

CustomFilterModule might be the one.

@kgabryje
Copy link
Member Author

wait. it looks like the header menu has gone in this version. Could you check what is missing?

Which header menu? I'm comparing before/after side by side and I can't see a difference. Also nothing happens on right-click in both versions.

In the recording, I'm running master on localhost, and the other tab is the ephemeral env for this PR.

Screen.Recording.2025-02-21.at.19.18.25.mov

@@ -216,21 +231,16 @@ function GridTable<RecordType extends object>({
`}
>
<AgGridReact
// TODO: migrate to Theme API - https://www.ag-grid.com/react-data-grid/theming-migration/
theme="legacy"
Copy link
Member

Choose a reason for hiding this comment

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

with this theme value, the existing ag-theme-quartz styles are broken.
_DEV__Superset

Please migrate to theme api first to apply the theme name here.

@justinpark
Copy link
Member

wait. it looks like the header menu has gone in this version. Could you check what is missing?

Which header menu? I'm comparing before/after side by side and I can't see a difference. Also nothing happens on right-click in both versions.

In the recording, I'm running master on localhost, and the other tab is the ephemeral env for this PR.

Screen.Recording.2025-02-21.at.19.18.25.mov

I found that it's not related to this change but this ant dropdown migration.

I will fix the dropdown menu issue separately.

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 dependencies:npm size/L sqllab Namespace | Anything related to the SQL Lab testenv-up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants