You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "eschutho (via GitHub)" <gi...@apache.org> on 2025/09/19 00:07:30 UTC
[PR] feat: hide favorite column when no items are favorited [superset]
eschutho opened a new pull request, #35201:
URL: https://github.com/apache/superset/pull/35201
## SUMMARY
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 that provide no value to users.
The implementation adds a memoized helper that checks if any items on the page are favorited, and conditionally hides the favorite column when no favorites exist.
## BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
**Before**: Empty favorite column shows when user is logged in but no items are favorited
**After**: Favorite column is completely hidden when no items on the page have favorites
## TESTING INSTRUCTIONS
1. Start the development environment
2. Navigate to Charts page (`/chart/list/`)
3. Ensure you're logged in as a user with chart access
4. Verify that when no charts are marked as favorites, the favorite column is hidden
5. Add at least one chart to favorites and verify the column appears
6. Test the same behavior on the Dashboards page (`/dashboard/list/`)
## ADDITIONAL INFORMATION
- [x] Changes UI
- [x] Has been tested locally
- [x] No breaking changes
- [x] Follows existing code patterns
🤖 Generated with [Claude Code](https://claude.ai/code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: hide favorite column when no items are favorited [superset]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #35201:
URL: https://github.com/apache/superset/pull/35201#issuecomment-3310062680
🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) is building environment on [GHA](https://github.com/apache/superset/actions/runs/17844592517) for [320cc68](https://github.com/apache/superset/commit/320cc68)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: hide favorite column when no items are favorited [superset]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #35201:
URL: https://github.com/apache/superset/pull/35201#issuecomment-3313894658
🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) deployed environment on [GHA](https://github.com/apache/superset/actions/runs/17870199026) for [fb7692d](https://github.com/apache/superset/commit/fb7692d)
• **Environment:** http://44.243.116.69:8080 (admin/admin)
• **Lifetime:** 48h auto-cleanup
• **Updates:** New commits create fresh environments automatically
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: hide favorite column when no items are favorited [superset]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #35201:
URL: https://github.com/apache/superset/pull/35201#issuecomment-3314276978
🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) is building environment on [GHA](https://github.com/apache/superset/actions/runs/17872626584) for [c2355c7](https://github.com/apache/superset/commit/c2355c7)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: hide favorite column when no items are favorited [superset]
Posted by "korbit-ai[bot] (via GitHub)" <gi...@apache.org>.
korbit-ai[bot] commented on code in PR #35201:
URL: https://github.com/apache/superset/pull/35201#discussion_r2361412933
##########
superset-frontend/src/pages/DashboardList/index.tsx:
##########
@@ -300,6 +300,14 @@ function DashboardList(props: DashboardListProps) {
);
}
+ const hasFavoritesOnPage = useMemo(
+ () =>
+ dashboards.length > 0 &&
+ Object.keys(favoriteStatus).length === dashboards.length &&
+ Object.values(favoriteStatus).some(status => status === true),
+ [dashboards.length, favoriteStatus],
+ );
Review Comment:
### Extract Complex Favorites Logic <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The hasFavoritesOnPage calculation is complex and its purpose is not immediately clear from the implementation. The logic for determining if there are favorites on the page is embedded directly in the component.
###### Why this matters
Complex boolean logic embedded in components makes the code harder to maintain and test. If this favorites logic needs to be reused or modified, it would require changing the component directly.
###### Suggested change ∙ *Feature Preview*
Create a separate utility function to handle the favorites logic:
```typescript
const hasFavoritesOnPage = (dashboards: Dashboard[], favoriteStatus: Record<number, boolean>) => {
if (dashboards.length === 0) return false;
if (Object.keys(favoriteStatus).length !== dashboards.length) return false;
return Object.values(favoriteStatus).some(status => status === true);
};
// In component:
const hasFavoritesOnCurrentPage = useMemo(
() => hasFavoritesOnPage(dashboards, favoriteStatus),
[dashboards, favoriteStatus]
);
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ef18f5a6-41ee-4066-9e11-ea96279f4e38/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ef18f5a6-41ee-4066-9e11-ea96279f4e38?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ef18f5a6-41ee-4066-9e11-ea96279f4e38?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ef18f5a6-41ee-4066-9e11-ea96279f4e38?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ef18f5a6-41ee-4066-9e11-ea96279f4e38)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:1330746d-7b1f-488c-b3e3-c56295117cbb -->
[](1330746d-7b1f-488c-b3e3-c56295117cbb)
##########
superset-frontend/src/pages/ChartList/index.tsx:
##########
@@ -315,6 +315,14 @@ function ChartList(props: ChartListProps) {
};
};
+ const hasFavoritesOnPage = useMemo(
+ () =>
+ charts.length > 0 &&
+ Object.keys(favoriteStatus).length === charts.length &&
+ Object.values(favoriteStatus).some(status => status === true),
+ [charts.length, favoriteStatus],
+ );
Review Comment:
### Inefficient object iteration in useMemo <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The useMemo computation performs unnecessary Object.keys() and Object.values() operations on every render when favoriteStatus changes, even when the result would be the same.
###### Why this matters
This creates unnecessary computational overhead as Object.keys() and Object.values() iterate through the entire favoriteStatus object on each evaluation, which could be expensive with large datasets.
###### Suggested change ∙ *Feature Preview*
Optimize by using a more efficient approach that avoids full object iteration:
```typescript
const hasFavoritesOnPage = useMemo(
() => {
if (charts.length === 0) return false;
const statusKeys = Object.keys(favoriteStatus);
if (statusKeys.length !== charts.length) return false;
// Use for...in loop to short-circuit on first true value
for (const id in favoriteStatus) {
if (favoriteStatus[id] === true) return true;
}
return false;
},
[charts.length, favoriteStatus],
);
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4bca0a2a-1ac9-4c5a-9e2c-1d4c009fe772/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4bca0a2a-1ac9-4c5a-9e2c-1d4c009fe772?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4bca0a2a-1ac9-4c5a-9e2c-1d4c009fe772?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4bca0a2a-1ac9-4c5a-9e2c-1d4c009fe772?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4bca0a2a-1ac9-4c5a-9e2c-1d4c009fe772)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:54414f41-629f-440b-90c6-d1bad62d6961 -->
[](54414f41-629f-440b-90c6-d1bad62d6961)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: hide favorite column when no items are favorited [superset]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #35201:
URL: https://github.com/apache/superset/pull/35201#issuecomment-3313135790
🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) is building environment on [GHA](https://github.com/apache/superset/actions/runs/17865563292) for [c2355c7](https://github.com/apache/superset/commit/c2355c7)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: hide favorite column when no items are favorited [superset]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #35201:
URL: https://github.com/apache/superset/pull/35201#issuecomment-3310087390
🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) deployed environment on [GHA](https://github.com/apache/superset/actions/runs/17844592517) for [320cc68](https://github.com/apache/superset/commit/320cc68)
• **Environment:** http://35.91.137.179:8080 (admin/admin)
• **Lifetime:** 48h auto-cleanup
• **Updates:** New commits create fresh environments automatically
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: hide favorite column when no items are favorited [superset]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #35201:
URL: https://github.com/apache/superset/pull/35201#issuecomment-3313883192
🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) is building environment on [GHA](https://github.com/apache/superset/actions/runs/17870199026) for [fb7692d](https://github.com/apache/superset/commit/fb7692d)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: hide favorite column when no items are favorited [superset]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #35201:
URL: https://github.com/apache/superset/pull/35201#issuecomment-3313187363
🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) deployed environment on [GHA](https://github.com/apache/superset/actions/runs/17865563292) for [c2355c7](https://github.com/apache/superset/commit/c2355c7)
• **Environment:** http://54.200.186.20:8080 (admin/admin)
• **Lifetime:** 48h auto-cleanup
• **Updates:** New commits create fresh environments automatically
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: hide favorite column when no items are favorited [superset]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #35201:
URL: https://github.com/apache/superset/pull/35201#issuecomment-3314284182
🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) deployed environment on [GHA](https://github.com/apache/superset/actions/runs/17872626584) for [c2355c7](https://github.com/apache/superset/commit/c2355c7)
• **Environment:** http://54.218.88.229:8080 (admin/admin)
• **Lifetime:** 48h auto-cleanup
• **Updates:** New commits create fresh environments automatically
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: hide favorite column when no items are favorited [superset]
Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho closed pull request #35201: feat: hide favorite column when no items are favorited
URL: https://github.com/apache/superset/pull/35201
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org