Skip to content

fix: column sort in experiments table#1576

Open
shivoomiess wants to merge 20 commits into
developfrom
SWAP-5630-fix
Open

fix: column sort in experiments table#1576
shivoomiess wants to merge 20 commits into
developfrom
SWAP-5630-fix

Conversation

@shivoomiess

@shivoomiess shivoomiess commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR fixes the issue of column sorting not working properly in the Experiments Table.

Motivation and Context

The column sorting feature in the Experiments Table was not functioning as expected, leading to a less intuitive and potentially confusing user experience. This fix is necessary to ensure that users can sort data in a logical and predictable manner, improving the usability of the table.

Changes

  1. Debugging capabilities were added to React and the local backend to better facilitate future troubleshooting efforts.
  2. The backend's dev script was updated to include the --inspect flag, allowing for easier debugging.
  3. The ExperimentDataSource.ts file was updated to include a map of fields that can be sorted. This provides explicit control over which columns can have their sorting functionality enabled.
  4. The experiments.cy.ts e2e test file was updated to include tests for the sorting functionality of each column in the visit table. This ensures that our sorting feature works as expected in the future.

How Has This Been Tested?

Fixes Jira Issue

https://jira.ess.eu//browse/SWAP-5630

Depends On

Tests included/Docs Updated?

  • I have added tests to cover my changes.
  • All relevant doc has been updated

@shivoomiess
shivoomiess requested a review from a team as a code owner June 15, 2026 13:24
@shivoomiess
shivoomiess requested review from ChongJiaChua, jekabs-karklins and yoganandaness and removed request for a team and ChongJiaChua June 15, 2026 13:24
@shivoomiess shivoomiess self-assigned this Jun 15, 2026
@shivoomiess shivoomiess changed the title Fix: Column sorting not working Experiments Table fix: Column sorting not working Experiments Table Jun 15, 2026
@shivoomiess shivoomiess changed the title fix: Column sorting not working Experiments Table fix: column sorting not working in Experiments table Jun 15, 2026
@shivoomiess shivoomiess changed the title fix: column sorting not working in Experiments table fix: column sort in experiments table Jun 15, 2026
Comment thread apps/backend/package.json Outdated
Comment thread apps/backend/src/datasources/postgres/ExperimentDataSource.ts Outdated
Comment thread apps/backend/src/datasources/postgres/ExperimentDataSource.ts Outdated
Comment thread apps/e2e/cypress/e2e/experiments.cy.ts
Comment thread apps/e2e/cypress/e2e/experiments.cy.ts Outdated
Comment thread apps/backend/src/resolvers/queries/ExperimentsQuery.ts Outdated
Comment thread apps/backend/src/resolvers/queries/ExperimentsQuery.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes broken column sorting in the Experiments table by introducing a typed sort-field enum end-to-end (frontend → GraphQL → backend → DB column mapping) and updating UI/test behavior around sortable vs non-sortable columns.

Changes:

  • Replaced the experiments sortField GraphQL argument from String to a dedicated ExperimentTableSortField enum and threaded the type through resolvers/queries/datasources.
  • Added explicit mappings for sortable fields (UI column field → GraphQL enum → DB column) and disabled sorting for columns not supported at the DB layer.
  • Updated Cypress e2e coverage around experiments table sorting interactions and added local debugging configuration/script changes.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
apps/frontend/src/graphql/experiment/getAllExperiments.graphql Changes sortField variable type to ExperimentTableSortField to match backend typing.
apps/frontend/src/components/experiment/ExperimentsTable.tsx Maps MaterialTable column fields to sort enum values and disables sorting for unsupported columns.
apps/e2e/cypress/e2e/experiments.cy.ts Adds/adjusts e2e coverage for experiments table sorting for multiple roles.
apps/backend/src/resolvers/queries/ExperimentsQuery.ts Introduces ExperimentTableSortField enum and uses it for sortField argument typing.
apps/backend/src/queries/ExperimentQueries.ts Updates getExperiments signature to accept the new sort-field enum.
apps/backend/src/datasources/postgres/ExperimentDataSource.ts Adds enum→DB-column map and uses it to build the SQL ORDER BY.
apps/backend/src/datasources/mockups/ExperimentDataSource.ts Updates mock datasource signature to the new enum sort-field type.
apps/backend/src/datasources/ExperimentDataSource.ts Updates datasource interface signature to the new enum sort-field type.
apps/backend/package.json Adds --inspect=9229 to backend dev for easier debugging.
.zed/debug.json Adds Zed editor debug configurations (currently needs JSON validity fix).

Comment thread .zed/debug.json Outdated
Comment thread apps/e2e/cypress/e2e/experiments.cy.ts Outdated
Comment thread apps/e2e/cypress/e2e/experiments.cy.ts Outdated
Comment thread apps/e2e/cypress/e2e/experiments.cy.ts Outdated
Comment thread apps/e2e/cypress/e2e/experiments.cy.ts Outdated
Comment thread apps/backend/src/resolvers/queries/ExperimentsQuery.ts Outdated

@yoganandaness yoganandaness left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting to rename to a branch, which holds the context of the problem statement

Comment thread apps/backend/package.json Outdated
Comment thread .zed/debug.json Outdated
@yoganandaness
yoganandaness requested review from simonfernandes and zacharyjhankin and removed request for jekabs-karklins July 21, 2026 13:34
@shivoomiess
shivoomiess enabled auto-merge (squash) July 22, 2026 08:56
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.

5 participants