|
| 1 | +## Summary |
| 2 | + |
| 3 | +The Flask flash message system is a legacy feature from when Superset was a server-rendered application. In the current SPA architecture, these messages are never displayed to users because: |
| 4 | +- Flash messages only render on page load via FlashProvider's componentDidMount |
| 5 | +- Modern UI interactions use async API calls that don't trigger page reloads |
| 6 | +- The main consumer (/explore/ POST endpoint) is already marked @deprecated |
| 7 | + |
| 8 | +All user-facing notifications are already handled by the frontend toast system, including chart save operations (see saveModalActions.ts) which dispatches success toasts for: |
| 9 | +- Chart saved/overwritten |
| 10 | +- Chart added to dashboard |
| 11 | +- New dashboard created with chart |
| 12 | + |
| 13 | +## Changes |
| 14 | + |
| 15 | +### Backend |
| 16 | +- Removed all flash() calls from views (14 occurrences in 4 files) |
| 17 | +- Converted error flashes to JSON responses or logging |
| 18 | +- Removed redirect_with_flash utility function |
| 19 | +- Fixed open redirect vulnerability in dashboard access denial |
| 20 | + |
| 21 | +### Frontend |
| 22 | +- Deleted FlashProvider component and tests |
| 23 | +- Removed flash_messages from CommonBootstrapData type |
| 24 | +- Cleaned up context providers and test fixtures |
| 25 | +- Removed unused getBootstrapData imports |
| 26 | + |
| 27 | +### Security Fixes |
| 28 | +- Fixed open redirect vulnerability by using url_for() instead of request.url |
| 29 | +- Dashboard access denial now uses safe URL construction |
| 30 | + |
| 31 | +### Code Cleanup |
| 32 | +- Removed unnecessary pass statements and comments |
| 33 | +- Converted permalink errors to JSON responses for consistency |
| 34 | +- Verified no tests depend on flash functionality |
| 35 | + |
| 36 | +## BREAKING CHANGE |
| 37 | +Removes flask.flash() messaging infrastructure. However, no actual functionality is lost as the frontend already handles all notifications through its own toast system. |
| 38 | + |
| 39 | +## TESTING INSTRUCTIONS |
| 40 | +1. Save a chart from Explore - verify toast notifications appear |
| 41 | +2. Add chart to dashboard - verify success message |
| 42 | +3. Try accessing a dashboard without permissions - verify proper redirect |
| 43 | +4. Run frontend tests: `npm test` |
| 44 | +5. Run backend tests: `pytest` |
| 45 | + |
| 46 | +## ADDITIONAL INFORMATION |
| 47 | +The application now relies entirely on client-side toast notifications for user feedback, which properly support async operations and provide a consistent UX. |
| 48 | + |
| 49 | +<!--- Required ---> |
| 50 | +- [x] Has associated issue: Fixes #35236 |
| 51 | +- [x] Required feature flags: None |
| 52 | +- [x] Changes UI: No (removes unused UI component) |
| 53 | +- [x] Includes DB Migration: No |
| 54 | + |
| 55 | +<!--- Check any relevant boxes with "x" ---> |
| 56 | +- [x] Bugfix (non-breaking change which fixes an issue) |
| 57 | +- [ ] New feature (non-breaking change which adds functionality) |
| 58 | +- [x] Breaking change (fix or feature that would cause existing functionality to not work as expected) |
| 59 | +- [ ] Documentation (typos, code examples, or any documentation update) |
0 commit comments