pomegranited opened a new pull request, #31692: URL: https://github.com/apache/superset/pull/31692
<!--- Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/ Example: fix(dashboard): load charts correctly --> ### SUMMARY Overrides FAB's LocaleView to redirect to the request's referrer instead of relying on the session page history as [suggested here](https://github.com/apache/superset/issues/12768#issuecomment-2376141202). This isn't a perfect solution, but it keeps the change very close to the actual issue. **Rejected alternatives** 1. Call `update_redirect()` whenever a GET view is rendered ([like this](https://github.com/apache/superset/compare/master...open-craft:superset:jill/update_redirect)). This is more in line with how Flask AppBuilder works (and was [recommended here](https://github.com/dpgaspar/Flask-AppBuilder/pull/1679#discussion_r702709749)). However, this only works for pages rendered by Superset's backend, and most Superset pages are rendered by the frontend. 2. Hook into the [frontend's action logging](https://github.com/apache/superset/blob/7c903236498281f34970012e701250edef1b1493/superset-frontend/src/views/App.tsx#L54-L69) to update the page history, e.g when a `LOG_ACTIONS_SPA_NAVIGATION` event is logged to the backend. This approach felt even hackier than the one posted here, and farther from the issue it addresses. Also, Flask AppBuilder only provides the `update_redirect()` method which uses the current `request.url`, so we'd need to add another method that could use a different `url`. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF Before: https://github.com/user-attachments/assets/7bcdefa5-46d5-4173-98cc-884384af233d After: https://github.com/user-attachments/assets/70b32340-7f23-482d-a33b-8347aa5000b0 ### TESTING INSTRUCTIONS 1. Load Superset with multiple languages enabled. 2. Visit any page. 3. Change your current language using the language switcher menu on the top right. 4. Ensure that your language is changed and you're redirect back to the page in step 2. ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [x] Fixes https://github.com/apache/superset/issues/12768 - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API -- 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]
