Refactor onSave and onCancel to track both layout and widgetArray useState() in order to restore state on cancel
This commit is contained in:
@@ -19,9 +19,8 @@ export default function Dashboard() {
|
||||
|
||||
const beginEditIfNeeded = () => {
|
||||
if ( !isEditable ) {
|
||||
// Save deep copies to preserve state
|
||||
setOriginalLayout(structuredClone(layout));
|
||||
setOriginalWidgets(structuredClone(widgetArray));
|
||||
setOriginalLayout(layout);
|
||||
setOriginalWidgets(widgetArray);
|
||||
setIsEditable(true);
|
||||
setIsDelete(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user