Repository navigation
Make the Undo button inert when there is nothing to undo #6082
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
Merged
+8
−2
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
494eccf
Initial plan
Copilot 1b6305a
Add skipped test: greyed-out Undo button animates with nothing to und…
Copilot d81ceb8
Disable the Undo command when there is nothing to undo (#5994)
Copilot 478dd56
Add skipped test: Undo works on the first edit after a reload
Copilot 3f1deef
Commit the first edit immediately when there is nothing to undo
Copilot 5a5ac4f
Remove Undo button e2e tests
raineorshine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This change results in the Undo toolbar button being disabled for ~500ms on the first edit due to the text edit throttling.
Can you please resolve this? One option to consider is updating
Editable.tsxto commit the first edit immediately by addingisUndoEnabledas one of the conditions here:em/src/components/Editable.tsx
Lines 848 to 855 in a80340a
Case to reproduce below (please also add as a test case, if feasible... not sure if we have a nice way to simulate reloading the app / starting with a thought but an empty history):
HelloHelloand typeW(becomingHelloW)Result: The "Undo" button is disabled for ~500ms until becoming active and working
Expected: The "Undo" button should become immediately active, as it does in
main.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.
Fixed in 3f1deef. I used your suggestion:
Editablenow commits an edit immediately when!isUndoEnabled(state), so the first keystroke after a reload enables Undo right away.Worldafter a reload and tapping Undo once still returns toHello, because the undo history merges the immediate edit with the throttled edits that follow it.src/e2e/puppeteer/__tests__/undo.ts(mobile, persistent storage). It reloads, typesWat the end ofHello, taps Undo right away, and expectsHello. Before the fix it failed withexpected 'HelloW' to be 'Hello'.docs/commands.md"Flushing pending edits" now describes this exception to the throttle.