Skip to content

fix(uve): sort content palette by 'Most Popular' in descending usage …#35851

Open
Neehakethi wants to merge 1 commit into
mainfrom
35848-fix-uve-palette-sort-most-popular
Open

fix(uve): sort content palette by 'Most Popular' in descending usage …#35851
Neehakethi wants to merge 1 commit into
mainfrom
35848-fix-uve-palette-sort-most-popular

Conversation

@Neehakethi
Copy link
Copy Markdown
Member

…order (#35848)

The 'Sort by Most Popular' option was passing direction: 'ASC' to the sort command, which put the lowest-usage content types first. Changed to 'DESC' so highest-usage content types appear at the top.

Also updated the corresponding unit tests to reflect the corrected direction, and added a new test asserting that the popular option is marked active when currentSort is { orderby: 'usage', direction: 'DESC' }.

Screen.Recording.2026-05-27.at.1.25.27.PM.mov

…order (#35848)

The 'Sort by Most Popular' option was passing direction: 'ASC' to the
sort command, which put the lowest-usage content types first. Changed
to 'DESC' so highest-usage content types appear at the top.

Also updated the corresponding unit tests to reflect the corrected
direction, and added a new test asserting that the popular option is
marked active when currentSort is { orderby: 'usage', direction: 'DESC' }.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 27, 2026

Claude finished @Neehakethi's task in 1m 11s —— View job


Review

The fix is correct and well-scoped: "Most Popular" now passes DESC, which is what the label implies (highest usage first). Tests updated, no leftover usage+ASC references in production code.

One thing worth a second look:

Stale localStorage persists the old (ASC) value for existing users.
The sort selection is persisted under dot-uve-palette-sort-options (store.ts:267-288) and rehydrated on init. A user who previously clicked "Most Popular" has { orderby: 'usage', direction: 'ASC' } saved in their browser. After this fix:

  • On their next visit, the store loads usage+ASC from localStorage and applies it — they still see lowest-usage first.
  • The menu won't highlight "Most Popular" as active either, since getSortActiveClass now only matches usage+DESC (utils/index.ts:116-119). The result is a slightly confusing "nothing is selected" state in the sort menu even though usage-based sort is in effect.
  • Clicking "Most Popular" again repairs the localStorage entry, so this self-heals on first interaction. Probably not blocking, but worth deciding consciously.

If you want to handle it transparently, the cleanest spot is the onInit hook in store.ts — normalize a loaded { orderby: 'usage', direction: 'ASC' } to DESC before patching state. Fix this →

Minor:

  • The leftover usage+ASC reference in utils.spec.ts:41 is fine — it's a getSortActiveClass test specifically asserting "direction mismatch returns false". Not a bug, just flagging in case it looks suspicious at a glance.
  • No backend/API direction-validation concerns: the direction value just flows through to the existing content-type list endpoint that already supports both ASC and DESC for other sorts.

Otherwise clean.
• Branch: 35848-fix-uve-palette-sort-most-popular

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : Frontend PR changes Angular/TypeScript frontend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[DEFECT] UVE Content Palette: "Sort by Most Popular" shows least-used content types first

3 participants