Skip to content
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

fix: archived releases table has default sort and defined sort working #9010

Merged
merged 1 commit into from
Mar 25, 2025

Conversation

jordanl17
Copy link
Member

@jordanl17 jordanl17 commented Mar 21, 2025

Description

  • Default sorting on a hidden column - which sorts by either _updatedAt or publishedAt depending on which is available
  • When sorting by published, all archived releases are at the end of the list, when sorting by archived, all published releases are at the end of the list
Scenario Before After
Default sort defaultSortOLD defaultSortNEW
Published at sort publishedSortOLD publishedSortNEW
Archived at sort archivedSortOLD ArchivedSortNEW

What to review

Supporting hidden columns in the Table - this is a bit of a hack just to support this particular case (where we want the default sorting to be across multiple columns. An alternative abstraction would be to move a function for default sorting out to the Table prop surface, but given the Table is only used within releases in 2 locations, going to those extents doesn't seem appropriate.

Testing

No new tests added, as Table isn't currently covered by tests

Notes for release

Fix for incorrect ordering when sorting archived and published releases in the Content Releases tool

Copy link

vercel bot commented Mar 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 22, 2025 0:37am
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 22, 2025 0:37am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 22, 2025 0:37am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Mar 22, 2025 0:37am
test-next-studio ⬜️ Ignored (Inspect) Mar 22, 2025 0:37am

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Mar 21, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 28.82% 37299 / 129384
🔵 Statements 28.82% 37299 / 129384
🔵 Functions 31.37% 1619 / 5160
🔵 Branches 69.68% 5180 / 7433
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/sanity/src/core/releases/tool/components/Table/Table.tsx 97.91% 70.17% 92.3% 97.91% 127-129, 131, 252
packages/sanity/src/core/releases/tool/components/Table/TableHeader.tsx 78.37% 92.3% 83.33% 78.37% 56-73
packages/sanity/src/core/releases/tool/components/Table/TableProvider.tsx 89.47% 69.23% 100% 89.47% 37, 52
packages/sanity/src/core/releases/tool/components/Table/types.ts 0% 0% 0% 0%
packages/sanity/src/core/releases/tool/overview/ReleasesOverview.tsx 93.08% 84.88% 80% 93.08% 89, 131-132, 150, 166, 235-239, 272-283, 290-294
packages/sanity/src/core/releases/tool/overview/ReleasesOverviewColumnDefs.tsx 93.92% 93.47% 89.47% 93.92% 115-121, 150-156
packages/sanity/src/core/releases/tool/overview/columnCells/ReleaseName.tsx 97.87% 90.9% 100% 97.87% 37, 66
Generated in workflow #32668 for commit cdce9a6 by the Vitest Coverage Report Action

Copy link
Contributor

github-actions bot commented Mar 21, 2025

⚡️ Editor Performance Report

Updated Sat, 22 Mar 2025 12:42:42 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 23.0 efps (44ms) 23.8 efps (42ms) -2ms (-3.4%)
article (body) 84.7 efps (12ms) 77.8 efps (13ms) +1ms (-/-%)
article (string inside object) 27.0 efps (37ms) 24.7 efps (41ms) +4ms (+9.5%)
article (string inside array) 22.7 efps (44ms) 21.7 efps (46ms) +2ms (+4.5%)
recipe (name) 47.6 efps (21ms) 47.6 efps (21ms) +0ms (-/-%)
recipe (description) 54.1 efps (19ms) 52.6 efps (19ms) +1ms (+2.7%)
recipe (instructions) 99.9+ efps (5ms) 99.9+ efps (5ms) +0ms (-/-%)
synthetic (title) 19.0 efps (53ms) 18.9 efps (53ms) +1ms (+1.0%)
synthetic (string inside object) 20.4 efps (49ms) 20.8 efps (48ms) -1ms (-2.0%)

efps — editor "frames per second". The number of updates assumed to be possible within a second.

Derived from input latency. efps = 1000 / input_latency

Detailed information

🏠 Reference result

The performance result of sanity@latest

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 44ms 48ms 58ms 324ms 256ms 11.9s
article (body) 12ms 14ms 16ms 43ms 52ms 5.1s
article (string inside object) 37ms 39ms 42ms 47ms 6ms 6.5s
article (string inside array) 44ms 46ms 49ms 90ms 329ms 7.1s
recipe (name) 21ms 22ms 26ms 40ms 0ms 7.0s
recipe (description) 19ms 19ms 20ms 22ms 0ms 4.6s
recipe (instructions) 5ms 7ms 8ms 9ms 0ms 3.1s
synthetic (title) 53ms 56ms 66ms 225ms 877ms 12.5s
synthetic (string inside object) 49ms 51ms 55ms 230ms 597ms 7.7s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 42ms 44ms 49ms 431ms 524ms 11.6s
article (body) 13ms 14ms 15ms 40ms 56ms 4.6s
article (string inside object) 41ms 43ms 45ms 132ms 172ms 6.9s
article (string inside array) 46ms 49ms 54ms 145ms 335ms 7.2s
recipe (name) 21ms 23ms 25ms 55ms 10ms 7.6s
recipe (description) 19ms 20ms 21ms 39ms 0ms 4.7s
recipe (instructions) 5ms 7ms 8ms 9ms 0ms 3.1s
synthetic (title) 53ms 55ms 62ms 250ms 732ms 12.6s
synthetic (string inside object) 48ms 51ms 59ms 218ms 610ms 7.7s

📚 Glossary

column definitions

  • benchmark — the name of the test, e.g. "article", followed by the label of the field being measured, e.g. "(title)".
  • latency — the time between when a key was pressed and when it was rendered. derived from a set of samples. the median (p50) is shown to show the most common latency.
  • p75 — the 75th percentile of the input latency in the test run. 75% of the sampled inputs in this benchmark were processed faster than this value. this provides insight into the upper range of typical performance.
  • p90 — the 90th percentile of the input latency in the test run. 90% of the sampled inputs were faster than this. this metric helps identify slower interactions that occurred less frequently during the benchmark.
  • p99 — the 99th percentile of the input latency in the test run. only 1% of sampled inputs were slower than this. this represents the worst-case scenarios encountered during the benchmark, useful for identifying potential performance outliers.
  • blocking time — the total time during which the main thread was blocked, preventing user input and UI updates. this metric helps identify performance bottlenecks that may cause the interface to feel unresponsive.
  • test duration — how long the test run took to complete.

Copy link
Contributor

github-actions bot commented Mar 21, 2025

📊 Playwright Test Report

Download Full E2E Report

This report contains test results, including videos of failing tests.

@jordanl17 jordanl17 marked this pull request as ready for review March 21, 2025 16:28
@jordanl17 jordanl17 requested review from a team, bjoerge and juice49 and removed request for a team and bjoerge March 21, 2025 16:28
sorting: true,
width: 100,
sortTransform: ({publishedAt, _updatedAt}) => {
// the default sort is always descending, so -Infinity pushes missing values to end
Copy link
Contributor

Choose a reason for hiding this comment

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

Very smart!

Copy link
Contributor

@RitaDias RitaDias left a comment

Choose a reason for hiding this comment

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

I think the solution is pretty smart. I'm still unsure how I feel about a hidden column. That being said, the code overall looks good to me. I think I would prefer to have someone else have a look at it too and have some more thoughts, maybe @pedrobonamin since I think you also did quite a bit of work on this table?

Copy link
Contributor

@pedrobonamin pedrobonamin left a comment

Choose a reason for hiding this comment

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

I think it's a very clever solution, fixes the issue without introducing too many changes to the codebase.

@jordanl17 jordanl17 merged commit 0b7097b into next Mar 25, 2025
60 checks passed
@jordanl17 jordanl17 deleted the fix/sapp-2492-archived-sort-ordering branch March 25, 2025 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants