Skip to content

Commit 320cc68

Browse files
eschuthoclaude
andcommitted
feat: hide favorite column when no items are favorited
Hide the favorite column in chart and dashboard list views when none of the items on the current page have been marked as favorites. This improves the UI by removing empty, non-functional columns. Changes: - Add memoized hasFavoritesOnPage helper to detect when favorites exist - Update column hidden condition to include favorite availability check - Apply consistently to both ChartList and DashboardList components 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 133e686 commit 320cc68

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

superset-frontend/src/pages/ChartList/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,14 @@ function ChartList(props: ChartListProps) {
315315
};
316316
};
317317

318+
const hasFavoritesOnPage = useMemo(
319+
() =>
320+
charts.length > 0 &&
321+
Object.keys(favoriteStatus).length === charts.length &&
322+
Object.values(favoriteStatus).some(status => status === true),
323+
[charts.length, favoriteStatus],
324+
);
325+
318326
const columns = useMemo(
319327
() => [
320328
{
@@ -334,7 +342,7 @@ function ChartList(props: ChartListProps) {
334342
id: 'id',
335343
disableSortBy: true,
336344
size: 'xs',
337-
hidden: !userId,
345+
hidden: !userId || !hasFavoritesOnPage,
338346
},
339347
{
340348
Cell: ({

superset-frontend/src/pages/DashboardList/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,14 @@ function DashboardList(props: DashboardListProps) {
300300
);
301301
}
302302

303+
const hasFavoritesOnPage = useMemo(
304+
() =>
305+
dashboards.length > 0 &&
306+
Object.keys(favoriteStatus).length === dashboards.length &&
307+
Object.values(favoriteStatus).some(status => status === true),
308+
[dashboards.length, favoriteStatus],
309+
);
310+
303311
const columns = useMemo(
304312
() => [
305313
{
@@ -319,7 +327,7 @@ function DashboardList(props: DashboardListProps) {
319327
id: 'id',
320328
disableSortBy: true,
321329
size: 'xs',
322-
hidden: !user?.userId,
330+
hidden: !user?.userId || !hasFavoritesOnPage,
323331
},
324332
{
325333
Cell: ({

0 commit comments

Comments
 (0)