Add favorites-first sort mode to sidebar dashboard list - #2631
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Visual recap — generation failedThe 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 |
There was a problem hiding this comment.
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
favoriteKeyOfremoves 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.
| 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)); |
There was a problem hiding this comment.
🟡 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.
|
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 |
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
favoritessort mode alongside the existing options. When selected, favorited items (matched via a sharedfavoriteKeyOfhelper) 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
favoritestoSidebarSortModeandDashboardSortModetypesfavoriteKeyOfhelper to consistently derive favorite keys for dashboards/analyses, replacing duplicated inline logicSidebarthat sorts alphabetically then stably groups favorites firstshouldRenderDashboardListto gate rendering onfavoritesLoadingfor bothmost-usedandfavoritesmodes, while only requiringpopularityReadyformost-usedsortFavoritesFirst,favoritesExplainer) across all supported localesTo clone this PR locally use the Github CLI with command
gh pr checkout 2631You can tag me at @BuilderIO for anything you want me to fix or change