Skip to content

refactor(Table): Use Table instead of html <table> in CollectionTable #33159

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

Merged
merged 14 commits into from
Apr 25, 2025

Conversation

msyavuz
Copy link
Member

@msyavuz msyavuz commented Apr 17, 2025

SUMMARY

Refactor DatasourceEditor and CollectionTable components to use our Table component instead of html table.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:
image
image

After:
image
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 Apr 17, 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

@msyavuz msyavuz changed the base branch from master to template_less April 17, 2025 07:59
@justinpark justinpark self-requested a review April 17, 2025 17:18
@msyavuz msyavuz marked this pull request as ready for review April 22, 2025 13:07
@dosubot dosubot bot added change:frontend Requires changing the frontend frontend:refactor Related to refactoring the frontend labels Apr 22, 2025
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 Status
Performance Inefficient Expanded Rows Calculation ▹ view 🧠 Not in standard
Files scanned
File Path Reviewed
superset-frontend/src/components/Datasource/types.ts
superset-frontend/src/components/Table/index.tsx
superset-frontend/cypress-base/cypress/support/directories.ts
superset-frontend/src/components/Datasource/CollectionTable.tsx
superset-frontend/src/components/Datasource/DatasourceEditor.jsx

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

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

Comment on lines +371 to 373
const expandedRowKeys = Object.keys(this.state.expandedColumns).filter(
id => this.state.expandedColumns[id],
);

This comment was marked as resolved.

Copy link
Contributor

@EnxDev Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments

Copy link
Contributor

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

@@ -113,6 +56,32 @@ const StyledButtonWrapper = styled.span`
`}
`;

type CollectionItem = { id: string | number; [key: string]: any };
Copy link
Contributor

@EnxDev EnxDev Apr 22, 2025

Choose a reason for hiding this comment

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

Would it be possible to define a more specific type here if we had better knowledge of the properties, to avoid any type?

I noticed there are quite a few other any types in the code — can we try to avoid them as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

I need generics for this type but the only component that uses this is jsx so generics don't do anything. But we should definitely consider replacing these with proper types when DatasourceEditor is typescript

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I think that's fine. The original intent when I built this a long time ago was for it to become the basis for all CRUD in the app, but ended up going a different way. If anything in the future, we'd remove this base component and go more towards what other CRUDs are using, if that makes sense. For now we'll flag as "needs refactor" and can do minimal edits to get theming through.

)}
</>
),
render: (text: any, record: CollectionItem) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

here as well

Copy link
Member Author

Choose a reason for hiding this comment

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

Same thing here, this could be anything and best way to handle this is through generics which we can't do.

ColumnsType,
SortOrder,
SorterResult,
TablePaginationConfig,
Copy link
Member

Choose a reason for hiding this comment

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

These need to be imported as type for proper tree shaking

@geido
Copy link
Member

geido commented Apr 23, 2025

From manual testing

The Table could benefit for more space as it is available

Screenshot 2025-04-23 at 15 14 51

Not sure if related but spacing is wrong
Screenshot 2025-04-23 at 15 16 08

There is a space when scrolling showing what's behind

Screenshot 2025-04-23 at 15 17 04

When typing it suddenly re-orders

Superset.mp4

This is weird. When first loading the Superset instance (no cache - try with Incognito), this is what happens for a few seconds before fixing itself

Screenshot 2025-04-23 at 15 20 17

There might be more but I'll give you a chance to look into these first

Copy link
Contributor

@EnxDev Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments

Copy link
Contributor

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

Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

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

LGTM

@mistercrunch mistercrunch merged commit a7b7e63 into template_less Apr 25, 2025
1 check passed
@mistercrunch mistercrunch deleted the msyavuz/refactor/use-ant-tables-datasource branch April 25, 2025 16:52
@EnxDev
Copy link
Contributor

EnxDev commented Apr 25, 2025

I believe this bug was introduced, could we fix it in a separate PR?

Recording.2025-04-25.195442.mp4

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 Related to refactoring the frontend size/XL testenv-up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants