Skip to content

Add favorites-first sort mode to sidebar dashboard list - #2631

Open
NKoech123 wants to merge 1 commit into
mainfrom
ai_main_c73078e0449545f7b7b6
Open

Add favorites-first sort mode to sidebar dashboard list#2631
NKoech123 wants to merge 1 commit into
mainfrom
ai_main_c73078e0449545f7b7b6

Conversation

@NKoech123

@NKoech123 NKoech123 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new "favorites" sort mode to the sidebar dashboard list, letting users pin their favorited dashboards/analyses to the top while the rest remain alphabetized.

Problem

The sidebar only supported sorting by most-used, alphabetical, or manual order. Users with many dashboards had no quick way to surface their favorites without relying on the "most-used" heuristic.

Solution

Introduced a favorites sort mode alongside the existing options. When selected, favorited items (matched via a shared favoriteKeyOf helper) are stably sorted to the top, with the remainder ordered alphabetically. Loading state logic was updated so the list waits for favorites data (but not popularity data) when this mode is active.

Key Changes

  • Added favorites to SidebarSortMode and DashboardSortMode types
  • Extracted favoriteKeyOf helper to consistently derive favorite keys for dashboards/analyses, replacing duplicated inline logic
  • Added favorites sorting branch in Sidebar that sorts alphabetically then stably groups favorites first
  • Added a fourth toggle option (star icon) in the sidebar sort settings popover, updating the grid layout to 4 columns
  • Updated shouldRenderDashboardList to gate rendering on favoritesLoading for both most-used and favorites modes, while only requiring popularityReady for most-used
  • Added unit tests covering favorites-mode loading behavior
  • Added i18n strings (sortFavoritesFirst, favoritesExplainer) across all supported locales
  • Added changelog entry for the new feature

Edit in Builder  Preview


To clone this PR locally use the Github CLI with command gh pr checkout 2631

You can tag me at @BuilderIO for anything you want me to fix or change

@builder-io-integration builder-io-integration Bot changed the title Update from the Builder.io agent Add favorites-first sort mode to sidebar dashboard list Aug 4, 2026
@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Visual recap — generation failed

The visual recap could not be generated for this pull request. This is informational only and does not block the PR.

Diagnostic:

No plan URL: Repair changed too much of targeted file plan.mdx; expected a localized parser fix.

Agent output: Repaired recap-source.json: closed both malformed Screen HTML expressions. JSON and expression syntax validate. --- ⠀ 🟢 Recap source repaired and ready for the single hosted-parser retry. stderr: Reading additional input from stdin...

@builder-io-integration builder-io-integration Bot 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.

Builder reviewed your changes and found 1 potential issue 🟡

Review Details

Code Review Summary

PR #2631 adds a persisted Favorites sort mode to the analytics sidebar, centralizes dashboard/analysis favorite-key derivation, updates the loading gate, and adds localized labels plus coverage for the new loading states. The core approach is sound: the new mode alphabetizes first and then uses a stable favorite grouping, while existing most-used, alphabetical, and manual modes remain structurally intact. This is a standard-risk change because it affects shared sidebar state and user-visible list ordering.

Key Findings

🟡 MEDIUM: A favorited nested dashboard can remain below an unfavorited parent group and may be hidden by the five-item top-level preview, so Favorites mode does not consistently surface all favorites.

Good patterns

  • favoriteKeyOf removes duplicated key derivation and is reused by both row rendering and sorting.
  • Loading behavior is covered for both Favorites and Most-used modes, including the distinction between favorites readiness and popularity readiness.
  • The new toggle is integrated into the existing ToggleGroup and the new strings are present across the supported locale catalogs.

🧪 Browser testing: Skipped — dev server is healthy, but browser executors in this environment have no Chrome/navigation tools; all planned UI test cases were reported as unable to verify due to that infrastructure limitation.

Comment on lines +1731 to +1735
if (dashboardSortMode === "favorites") {
const favoriteRank = (d: SidebarDashboard) =>
favoriteIds.has(favoriteKeyOf(d)) ? 0 : 1;
// Stable sort keeps each group in alphabetical order.
return sortByName(all).sort((a, b) => favoriteRank(a) - favoriteRank(b));

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.

🟡 Favorited nested dashboards can be hidden below non-favorites

The favorites comparator ranks each dashboard independently, but the later nesting step removes children from topLevelDashboards and renders them under their parent. A SQL dashboard can be favorited while its parent is not; in that case the child stays in the non-favorite parent group, and if that parent falls outside the five-item preview, the favorited child is not visible until “Show more.” Rank parent groups by whether they or any rendered child is favorited, or otherwise ensure favorited children remain accessible in the favorites section.

Additional Info
Found by 1 of 2 parallel code-review agents; browser confirmation was blocked by missing executor navigation tools.

Fix in Builder

@steve8708

Copy link
Copy Markdown
Contributor

favorites should always be on top by default - they shoudln't need a separate sort mode. if favorites don't show at the top, then that would be the bug i'd fix

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