massucattoj opened a new pull request, #39984:
URL: https://github.com/apache/superset/pull/39984

   ### SUMMARY
   The "Last modified" column on the chart list page (/chart/list/) was sorting 
incorrectly because the displayed value and the sort key referenced different 
fields:
   
     - Displayed: changed_on_delta_humanized (derived from changed_on, the 
row's last write timestamp — always populated)
     - Sorted by: last_saved_at (a separate nullable field that only updates on 
an explicit user save via the explore PUT endpoint)
   
   Charts with NULL last_saved_at (never saved by a user) or with divergent 
last_saved_at/changed_on appeared out of order, since the visible humanized 
date didn't match the underlying sort key.
   
   This change aligns the column's accessor/id with the displayed value 
(changed_on_delta_humanized), matching the existing pattern in DashboardList 
and SavedQueryList. The backend already supports ordering by 
changed_on_delta_humanized via the @renders("changed_on") decorator in 
superset/models/helpers.py, so it correctly sorts by the underlying changed_on 
datetime column.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   Before:
   <img width="1400" height="477" alt="Screenshot 2026-05-08 at 22 29 26" 
src="https://github.com/user-attachments/assets/ca10a7f2-f7ea-47cd-81c3-8d74c6a20da5";
 />
   
   After:
   <img width="1466" height="389" alt="Screenshot 2026-05-08 at 22 29 42" 
src="https://github.com/user-attachments/assets/d16b9818-c90d-4786-8ecd-14da7c2549c4";
 />
   
   ### TESTING INSTRUCTIONS
   To reproduce, you need charts with divergent changed_on and last_saved_at 
values (a fresh seed will not show the bug since both columns are populated 
identically at insert time).
   
   1. Connect to the metadata DB and create divergence:
   ```
   UPDATE slices SET changed_on = NOW() - INTERVAL '2 years'         WHERE id % 
4 = 0;
   UPDATE slices SET changed_on = NOW() - INTERVAL '1 year 6 months' WHERE id % 
4 = 1;
   UPDATE slices SET changed_on = NOW() - INTERVAL '8 months'        WHERE id % 
4 = 2;
   UPDATE slices SET changed_on = NOW() - INTERVAL '3 months'        WHERE id % 
4 = 3;
   
   UPDATE slices SET last_saved_at = NOW() - INTERVAL '3 months'        WHERE 
id % 4 = 0;
   UPDATE slices SET last_saved_at = NOW() - INTERVAL '2 years'         WHERE 
id % 4 = 1;
   UPDATE slices SET last_saved_at = NOW() - INTERVAL '1 year 6 months' WHERE 
id % 4 = 2;
   UPDATE slices SET last_saved_at = NOW() - INTERVAL '8 months'        WHERE 
id % 4 = 3;
   UPDATE slices SET last_saved_at = NULL WHERE id % 11 = 0;
   ```
   2. Navigate to /chart/list/.
   3. Click the Last modified column header to sort.
   4. Toggle ASC/DESC and page through the results.
   5. Verify the humanized timestamps appear in monotonic order (no "2 years 
ago" sandwiched between recent entries, no "7 months ago" appearing among older 
blocks).
   
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [x] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] 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]

Reply via email to