Skip to content

Commit

Permalink
feedback(ui): updated conditionals for handleWorkFlow Redo and Undo
Browse files Browse the repository at this point in the history
  • Loading branch information
billcookie committed Dec 6, 2024
1 parent 570ad3b commit 0914438
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ui/src/lib/yjs/useYjsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,18 @@ export default ({
const { createDeployment, useUpdateDeployment } = useDeployment();

const handleWorkflowUndo = useCallback(() => {
if (undoManager?.undoStack && undoManager.undoStack.length > 0) {
const stackLength = undoManager?.undoStack?.length ?? 0;
if (stackLength > 0) {
undoManager?.undo();
}
}, [undoManager]);

const handleWorkflowRedo = useCallback(() => {
if (undoManager?.redoStack && undoManager.redoStack.length > 0) {
const stackLength = undoManager?.redoStack?.length ?? 0;
if (stackLength > 0) {
undoManager?.redo();
}
}, [undoManager]);

const canUndo = useMemo(() => {
const stackLength = undoManager?.undoStack?.length ?? 0;
return stackLength > 0;
Expand Down

0 comments on commit 0914438

Please sign in to comment.