korbit-ai[bot] commented on code in PR #33007:
URL: https://github.com/apache/superset/pull/33007#discussion_r2029898780
##########
superset-frontend/src/dashboard/actions/dashboardState.js:
##########
@@ -98,23 +98,25 @@ export function toggleFaveStar(isStarred) {
return { type: TOGGLE_FAVE_STAR, isStarred };
}
-export function fetchFaveStar(id) {
- return function fetchFaveStarThunk(dispatch) {
+export function fetchFavoriteStatus(dashboardId) {
+ return dispatch => {
return SupersetClient.get({
- endpoint: `/api/v1/dashboard/favorite_status/?q=${rison.encode([id])}`,
+ endpoint: `/api/v1/dashboard/${dashboardId}/favorite_status`,
})
.then(({ json }) => {
- dispatch(toggleFaveStar(!!json?.result?.[0]?.value));
+ dispatch({ type: FETCH_FAVORITE_STATUS_SUCCESS, isStarred:
json.is_starred });
})
- .catch(() =>
+ .catch(error => {
+ if (error.status === 404) {
+ return; // Silently ignore if dashboard is deleted
+ }
dispatch(
- addDangerToast(
t(
'There was an issue fetching the favorite status of this
dashboard.',
),
),
Review Comment:
### Missing Error Toast Action <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The error dispatch is missing the addDangerToast action wrapper causing the
error message to not be displayed properly.
###### Why this matters
Without wrapping the translated message in addDangerToast, the error
notification won't be shown to the user, leading to silent failures.
###### Suggested change ∙ *Feature Preview*
Wrap the error message in addDangerToast:
```javascript
dispatch(
addDangerToast(
t('There was an issue fetching the favorite status of this dashboard.')
)
);
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/543c9a1e-3d41-452b-88fa-2af47d4a2acd/upvote)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/543c9a1e-3d41-452b-88fa-2af47d4a2acd?what_not_true=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/543c9a1e-3d41-452b-88fa-2af47d4a2acd?what_out_of_scope=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/543c9a1e-3d41-452b-88fa-2af47d4a2acd?what_not_in_standard=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/543c9a1e-3d41-452b-88fa-2af47d4a2acd)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:e5fa47ab-cb4b-4da0-b7e7-75b5918ea59f -->
[](e5fa47ab-cb4b-4da0-b7e7-75b5918ea59f)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]