excalidraw icon indicating copy to clipboard operation
excalidraw copied to clipboard

fix: undo/redo when exiting view mode

Open Vatsalsoni13 opened this issue 1 year ago • 1 comments

Description

This PR addresses the bug: When exiting view mode the undo/redo buttons are disabled even though their stacks aren't empty.

Fix

Fixes https://github.com/excalidraw/excalidraw/issues/7948. The default constructor is getting called which has values isUndoStackEmpty equal to true and isRedoStackEmpty equal to true. Passing the function(from class History) which checks for whether the stacks are empty or not fixes the issue.

Comparison

Before

https://github.com/excalidraw/excalidraw/assets/53573748/ff57b133-8d9b-4574-8e69-e59b60177b85

After

https://github.com/excalidraw/excalidraw/assets/53573748/329588d3-b6bb-4eea-8fe8-d9faa6810da1

Vatsalsoni13 avatar May 16 '24 14:05 Vatsalsoni13

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
excalidraw ✅ Ready (Inspect) Visit Preview May 19, 2024 1:07pm
excalidraw-package-example ✅ Ready (Inspect) Visit Preview May 19, 2024 1:07pm
excalidraw-package-example-with-nextjs ✅ Ready (Inspect) Visit Preview May 19, 2024 1:07pm
1 Ignored Deployment
Name Status Preview Updated (UTC)
docs ⬜️ Ignored (Inspect) Visit Preview May 19, 2024 1:07pm

vercel[bot] avatar May 16 '24 14:05 vercel[bot]

Hello, I tried rerunning the test files on my local machine but I don't seem to get the error which is shown above. It would be very helpful if someone could explain what exactly is the testcase testing. I tried searching for documentation related to tests in the repo but couldn't find it. Thank you. (I'm new to open-source apologies if it is trivial) Edit: Checks have been passed

Vatsalsoni13 avatar May 17 '24 04:05 Vatsalsoni13

I tried rerunning the test files on my local machine but I don't seem to get the error which is shown above. It would be very helpful if someone could explain what exactly is the testcase testing. I tried searching for documentation related to tests in the repo but couldn't find it.

Yeah, we have some flaky tests in the history test suite, we'll need to fix.

Anyway, I added tests for this PR. We're good to go. Thanks!

dwelle avatar May 19 '24 13:05 dwelle