rusackas opened a new pull request, #38156:
URL: https://github.com/apache/superset/pull/38156

   ### SUMMARY
   
   Fixes a race condition where navigating between dashboards could show error 
toasts for dashboards the user is no longer viewing.
   
   **The Problem:**
   When a user:
   1. Creates a dashboard (e.g., ID 258)
   2. Deletes that dashboard
   3. Navigates to another dashboard (e.g., ID 55)
   
   The `favorite_status` API call for the deleted dashboard (258) would 
complete and show an error toast: "There was an issue fetching the favorite 
status of this dashboard." This is confusing because the user is now viewing a 
different dashboard.
   
   **Root Cause:**
   The `fetchFaveStar` and `saveFaveStar` Redux thunks would dispatch actions 
(including error toasts) regardless of whether the requested dashboard ID still 
matched the currently viewed dashboard. This allowed stale API responses to 
affect the UI after navigation.
   
   **The Fix:**
   Before dispatching any actions in the thunk callbacks, check if 
`dashboardInfo.id` from the current Redux state matches the `id` that was 
originally requested. If they don't match, the response is stale and should be 
silently ignored.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   **Before:**
   When navigating from a deleted dashboard to another dashboard, error toasts 
would appear for the deleted dashboard.
   
   **After:**
   Stale responses are silently ignored, preventing confusing error messages.
   
   ### TESTING INSTRUCTIONS
   
   1. Create a new dashboard and save it
   2. Note the dashboard ID from the URL
   3. Delete the dashboard
   4. Navigate to any other dashboard
   5. Verify no error toast appears about "fetching the favorite status"
   
   Alternative test (without deletion):
   1. Open Network tab in DevTools
   2. Add throttling to simulate slow network
   3. Navigate from one dashboard to another quickly
   4. Verify no duplicate/stale favorite status updates occur
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: Fixes #32533
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 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: [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]

Reply via email to