Skip to content

Implement the Hardware Configuration table to sort by ascending order#2194

Open
Taj010 wants to merge 5 commits intokubeflow:mainfrom
Taj010:hardware-table-sort
Open

Implement the Hardware Configuration table to sort by ascending order#2194
Taj010 wants to merge 5 commits intokubeflow:mainfrom
Taj010:hardware-table-sort

Conversation

@Taj010
Copy link
Contributor

@Taj010 Taj010 commented Feb 4, 2026

Description

Fixed the current default sorting in Performance Insights. The default order of records in the Hardware Configuration table is now sorted in ASC order by the selected Metric & Percentile.

How Has This Been Tested?

This has been manually tested by checking if the selected metric values are sorted by ascending order.

Merge criteria:

  • All the commits have been signed-off (To pass the DCO check)
  • The commits have meaningful messages
  • Automated tests are provided as part of the PR for major new functionalities; testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work.
  • Code changes follow the kubeflow contribution guidelines.
  • For first time contributors: Please reach out to the Reviewers to ensure all tests are being run, ensuring the label ok-to-test has been added to the PR.

If you have UI changes

  • The developer has added tests or explained why testing cannot be added.
  • Included any necessary screenshots or gifs if it was a UI change.
  • Verify that UI/UX changes conform the UX guidelines for Kubeflow.

@google-oss-prow google-oss-prow bot requested review from fege and pboyd February 4, 2026 20:51
Copy link
Contributor

@YuliaKrimerman YuliaKrimerman left a comment

Choose a reason for hiding this comment

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

Why do we need both sortedData pre-sorting AND defaultSortColumn? Does the Table component not automatically sort on the default column, or is there a specific reason we need to pre-sort the data?

Comment on lines 51 to 60
const sortedData = React.useMemo(() => {
if (!sortColumn) {
return performanceArtifacts;
}
const sortFn = sortColumn.sortable;
if (typeof sortFn !== 'function') {
return performanceArtifacts;
}
return [...performanceArtifacts].toSorted((a, b) => sortFn(a, b, sortColumn.field));
}, [sortColumn, performanceArtifacts]);
Copy link
Contributor

Choose a reason for hiding this comment

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

The Table component already has sorting built-in via defaultSortColumn. Why are we pre-sorting the data AND setting defaultSortColumn? This feels like we're doing the work twice. Can we just rely on the Table's sorting with defaultSortColumn={sortIndex} and not pre-sort?

Copy link
Contributor

@mturley mturley left a comment

Choose a reason for hiding this comment

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

@Taj010 the reason we needed your mod-arch-shared update to lift sort state outside the Table is that we need more than just to set the default, we need to update the sort each time the user changes the latency filter's metric or percentile so it is sorted by the matching column. That requires us to lift the sort state out of the Table so we can update it from elsewhere, which will require installing the new version of mod-arch-shared that includes your new changes to Table to make that possible.

You might need that state to originate in the useHardwareConfigColumns hook. That's where we already have an effect that changes the selected columns in the manage columns modal when the latency filter changes, you can probably piggyback on that same logic, it already parses out the correct latency filter key you need. https://github.com/kubeflow/model-registry/blob/main/clients/ui/frontend/src/app/pages/modelCatalog/components/useHardwareConfigColumns.ts#L115

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from mturley. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot added size/L and removed size/S labels Feb 6, 2026
// Add the matching TPS column (if not already present)
if (!newVisibleIds.includes(matchingTpsPropertyKey)) {
newVisibleIds.push(matchingTpsPropertyKey);
// Ensure sort is set correctly when columns are ready (handles initial mount case)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I ended up using two useEffect hooks to keep the sorting in sync. The first one handles the immediate visibility change when a filter is picked, and the second one acts as a 'safety check' to make sure the sortIndex actually points to the right column after the table re-renders.

I tried combining them, but it kept breaking the sort during transitions. This is the best I could come up with, but let me know if you think there's a cleaner way to handle the state dependency

Signed-off-by: Taj010 <rsheen003@gmail.com>
Signed-off-by: Taj010 <rsheen003@gmail.com>
Signed-off-by: Taj010 <rsheen003@gmail.com>
Signed-off-by: Taj010 <rsheen003@gmail.com>
Signed-off-by: Taj010 <rsheen003@gmail.com>
@Taj010 Taj010 force-pushed the hardware-table-sort branch from 9ee0699 to 36d5591 Compare February 6, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants