-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Prevent undo functionality from referencing incorrect dashboard edits #31809
base: master
Are you sure you want to change the base?
Conversation
…rryover issues. Ensure undo actions apply only to the current dashboard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
Category | Issue | Fix Detected |
---|---|---|
Improper Redux State Mutation ▹ view | ✅ |
Need a new review? Comment
/korbit-review
on this PR and I'll review your latest changes.Korbit Guide: Usage and Customization
Interacting with Korbit
- You can manually ask Korbit to review your PR using the
/korbit-review
command in a comment at the root of your PR.- You can ask Korbit to generate a new PR description using the
/korbit-generate-pr-description
command in any comment on your PR.- Too many Korbit comments? I can resolve all my comment threads if you use the
/korbit-resolve
command in any comment on your PR.- Chat with Korbit on issues we post by tagging @korbit-ai in your reply.
- Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.
Customizing Korbit
- Check out our docs on how you can make Korbit work best for you and your team.
- Customize Korbit for your organization through the Korbit Console.
Feedback and Support
export function resetDashboardPast() { | ||
return (dispatch, getState) => { | ||
const { dashboardLayout } = getState(); | ||
dashboardLayout.past = []; // Set `past` as an empty array | ||
}; | ||
} |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fardin-developer I don't think you should edit the state here? Why not in the reducers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clearing history from redux undo
@@ -668,6 +673,7 @@ const Header = () => { | |||
NavExtension, | |||
boundActionCreators.onRedo, | |||
boundActionCreators.onUndo, | |||
boundActionCreators.clearDashboardHistory(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're executing the function in the dependent list
boundActionCreators.clearDashboardHistory(), | |
boundActionCreators.clearDashboardHistory, |
Looks great, once Justin’s comment is addressed it’s good to merge |
Fixes #31344
Description
This PR fixes a bug where the "Undo" button displays actions from a previously edited dashboard after switching to a new one. The issue occurred because the dashboardLayout.past array, which stores the undo history, was not cleared when switching between dashboards or entering edit mode.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before
https://drive.google.com/file/d/1ddAJXwsBFAmTHtpjKqo-fRAzk6fu4aek/view?usp=sharing
After
https://drive.google.com/file/d/1fvomN09d4G_87We-YfOaAurMTTcQ7dAO/view?usp=sharing
Key Changes:
Reset Dashboard History:
Introduced the resetDashboardPast function to ensure the dashboardLayout.past array is cleared when toggling edit mode.
Edit Button Update:
Updated the "Edit Dashboard" button to call the resetDashboardPast function via boundActionCreators.clearDashboardHistory() when clicked.
Reproduction Steps
Expected Behavior: