You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "gabotorresruiz (via GitHub)" <gi...@apache.org> on 2025/08/20 16:47:34 UTC
[PR] fix(dashboard): enable undo/redo buttons for layout changes [superset]
gabotorresruiz opened a new pull request, #34777:
URL: https://github.com/apache/superset/pull/34777
<!---
Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
Example:
fix(dashboard): load charts correctly
-->
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
Fixed a bug where undo/redo buttons in dashboard edit mode weren't getting enabled when adding or removing dashboard components. The issue was caused by a known bug in the redux-undo library where the `includeAction` filter incorrectly filters out actions that should be tracked.
**Root Cause**: Redux-undo's filter functionality is broken in multiple versions (including the beta version used by Superset), causing layout actions like `DELETE_COMPONENT` to be incorrectly excluded from undo history.
**Solution**: Implemented reducer-level filtering by wrapping the base `dashboardLayout` reducer before passing it to redux-undo. This approach:
- Prevents non-layout actions from reaching the reducer (no state change = no undo entry)
- Allows redux-undo to work without filtering (which works correctly)
- Maintains proper action filtering while avoiding the redux-undo bug
- Is well-documented with references to upstream bug reports for future removal
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
Before:

After:

### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
1. Open a dashboard in edit mode
2. Add a new chart component to the dashboard
3. Verify the undo button becomes enabled
4. Delete a chart component from the dashboard
5. Verify the undo button becomes enabled
6. Click undo to verify the action is reversed
7. Verify the redo button becomes enabled after undoing
8. Click redo to verify the action is re-applied
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] 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: 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] fix(dashboard): enable undo/redo buttons for layout changes [superset]
Posted by "gabotorresruiz (via GitHub)" <gi...@apache.org>.
gabotorresruiz commented on PR #34777:
URL: https://github.com/apache/superset/pull/34777#issuecomment-3207406451
@rusackas yep, I'm on it
--
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] fix(dashboard): enable undo/redo buttons for layout changes [superset]
Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho merged PR #34777:
URL: https://github.com/apache/superset/pull/34777
--
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] fix(dashboard): enable undo/redo buttons for layout changes [superset]
Posted by "korbit-ai[bot] (via GitHub)" <gi...@apache.org>.
korbit-ai[bot] commented on code in PR #34777:
URL: https://github.com/apache/superset/pull/34777#discussion_r2288762806
##########
superset-frontend/src/dashboard/reducers/undoableDashboardLayout.js:
##########
@@ -33,20 +33,69 @@ import { HYDRATE_DASHBOARD } from '../actions/hydrate';
import dashboardLayout from './dashboardLayout';
-export default undoable(dashboardLayout, {
+// List of actions that should trigger undo history
+const TRACKED_ACTIONS = [
+ HYDRATE_DASHBOARD,
+ UPDATE_COMPONENTS,
+ DELETE_COMPONENT,
+ CREATE_COMPONENT,
+ CREATE_TOP_LEVEL_TABS,
+ DELETE_TOP_LEVEL_TABS,
+ RESIZE_COMPONENT,
+ MOVE_COMPONENT,
+ HANDLE_COMPONENT_DROP,
+];
Review Comment:
### Problematic Hydration Action Tracking <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
Including HYDRATE_DASHBOARD in tracked actions could cause issues with undo/redo when the dashboard is rehydrated from a saved state.
###### Why this matters
If hydration is undoable, users might accidentally undo to a stale state, losing their current dashboard configuration unexpectedly.
###### Suggested change ∙ *Feature Preview*
Remove HYDRATE_DASHBOARD from tracked actions:
```javascript
const TRACKED_ACTIONS = [
UPDATE_COMPONENTS,
DELETE_COMPONENT,
CREATE_COMPONENT,
CREATE_TOP_LEVEL_TABS,
DELETE_TOP_LEVEL_TABS,
RESIZE_COMPONENT,
MOVE_COMPONENT,
HANDLE_COMPONENT_DROP,
];
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/8ae07a14-be7b-4e5e-ad3b-ffcd0819661d/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/8ae07a14-be7b-4e5e-ad3b-ffcd0819661d?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/8ae07a14-be7b-4e5e-ad3b-ffcd0819661d?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/8ae07a14-be7b-4e5e-ad3b-ffcd0819661d?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/8ae07a14-be7b-4e5e-ad3b-ffcd0819661d)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:2cf2a996-2138-4beb-86ed-3a4a7e2b01ae -->
[](2cf2a996-2138-4beb-86ed-3a4a7e2b01ae)
--
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] fix(dashboard): enable undo/redo buttons for layout changes [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #34777:
URL: https://github.com/apache/superset/pull/34777#issuecomment-3207400753
Can we add tests? If it broke once, it might break again :)
--
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