RehanIslam09 opened a new pull request, #41976:
URL: https://github.com/apache/superset/pull/41976
### SUMMARY
Fixes #37892.
The Time-series Table visualization previously sorted computed columns using
values exposed by the rendered `ValueCell`. While this worked for simple
numeric values, computed columns (such as Time Comparison, Contribution, and
Average) could be sorted incorrectly because the sorting logic was not using
the same computed values that were displayed in the table.
This change moves the computation of cell values into `TimeTable`, where each
cell's value and error state are calculated once before rendering. The
computed
value is then passed directly to `ValueCell`, allowing both rendering and
sorting to use the same source of truth.
As part of this refactor:
- Compute each cell's value once in `TimeTable`.
- Pass the computed value and error state directly to `ValueCell`.
- Simplify `ValueCell` into a presentational component.
- Update `ValueCell` tests to reflect the new component API.
This removes duplicate calculations and ensures computed columns are sorted
according to the values displayed to users.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A (logic-only change).
### TESTING INSTRUCTIONS
1. Run Superset in development mode.
2. Create or open a Time-series Table visualization.
3. Select a dataset with at least one metric and one dimension.
4. Add one or more computed columns (for example Time Comparison,
Contribution, or Average).
5. Run the query.
6. Click a computed column header to sort ascending and descending.
7. Verify that the rows are sorted according to the computed values shown in
the table.
### ADDITIONAL INFORMATION
- [x] Has associated issue: Fixes #37892
- [ ] 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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]