Skip to content
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

Undo/Redo action #226

Closed
8 of 10 tasks
oliviertassinari opened this issue Mar 25, 2022 · 11 comments
Closed
8 of 10 tasks

Undo/Redo action #226

oliviertassinari opened this issue Mar 25, 2022 · 11 comments
Assignees
Labels
feature: App Editor new feature New feature or request scope: toolpad-studio Abbreviated to "studio"

Comments

@oliviertassinari
Copy link
Member

oliviertassinari commented Mar 25, 2022

The very first frustration I had using the tool today is not being able to undo a change. I have tried a change that didn't work, now, I'm not sure how to get back to the previous state that was better. It doesn't incentive me to experiment.

To do:

  • basic undo/redo based on a undo history stack of the dom state Add undo & redo functionality #1225
  • Keyboard shortcut: Undo Ctrl+Z and Redo Ctrl+Shift+Z Fix windows and AZERTY shortcuts for undo redo #1274
  • undo/redo button needs to be disabled when the stack is empty
  • If undoing/redoing change that is in a different view - don't do the undo, focus that view instead (i.e. we made changes in connection view, went to canvas editor and did undo - we should end up in connection view). For extra context, read the discussion in Add undo & redo functionality #1225 (comment)
  • make atomic changes instead of using a throttle to combine changes, currently known issues:
    • Combine multiple changes when typeing an input of a string property value. What's the best way?
    • Make insertion of elements atomic Single-update undo/redo #1374
    • ...?
  • Display a history of changes
  • Make dom selection part of undo/redo

How do other tools push to history when typing text?

debounce throttle word delimiters
google docs
notion
vscode
figma
@prakhargupta1
Copy link
Member

To get some idea on how Undo and Redo should work in different scenarios:
appsmithorg/appsmith#1426 (comment)

@prakhargupta1 prakhargupta1 added this to the Q2 milestone May 2, 2022
@prakhargupta1 prakhargupta1 modified the milestones: Q2-May, Q2-June Jun 2, 2022
@prakhargupta1 prakhargupta1 modified the milestones: Q2-June, Q3 Jul 6, 2022
@prakhargupta1 prakhargupta1 modified the milestones: Beta, backlog Aug 16, 2022
@prakhargupta1 prakhargupta1 removed this from the Backlog milestone Aug 29, 2022
@apedroferreira
Copy link
Member

First prerequisite for undo/redo: #845

@bytasv
Copy link
Contributor

bytasv commented Oct 28, 2022

As a follow up to #1225 we should make following UX improvement:

  • If undoing/redoing change that is in a different view - focus that view (i.e. we made changes in connection view, went to canvas editor and did undo - we should end up in connection view)

High level pseudo-code proposal:

function getViewForDom(dom: AppDom): ToolpadView
function isSameView(view1: ToolpadView, view2: ToolpadView): boolean
function navigateToView(ToolpadView): void

@apedroferreira
Copy link
Member

High level pseudo-code proposal:

Maybe focusOnView instead of navigateToView? Other than that sounds good if we need this type of solution.

@Janpot
Copy link
Member

Janpot commented Oct 28, 2022

This was just some pseudo-code to illustrate an idea, I didn't intend for this to be used as a starting point or anything.

@prakhargupta1 prakhargupta1 moved this from Future to Q4 2022 Oct-Dec in MUI Toolpad public roadmap Nov 1, 2022
@oliviertassinari
Copy link
Member Author

oliviertassinari commented Nov 10, 2022

Screen.Recording.2022-11-10.at.19.16.44.mov

When I press Cmd+Z key, it undo 2 actions, not one. In the same way, when I press the shortcut to redo my change after the undo, it doesn't work. It seems that undo/redo is strongly tight to what is committed on the backend. I think that it would be great to decorrelate the two notions. Fixed in #1328

  • I don't think that the undo/redo button will ever be used more than 5% of the time, I think that it could be hidden from the interface, into a submenu like notion has:

Screenshot 2022-11-10 at 19 41 15

Or Figma, even better:

Screenshot 2022-11-10 at 19 42 19

Screenshot 2022-11-10 at 19 42 32


@bytasv
Copy link
Contributor

bytasv commented Nov 11, 2022

The undo / redo has a bug

@oliviertassinari thanks, that's a great catch. I already found the cause - it happens because throttled undo stack update is triggered after we undo action which messes up the state. I have one working solution to the issue that makes situation way better, but not perfect yet, I should post an update soon

I don't think that the undo/redo button will ever be used more than 5% of the time, I think that it could be hidden from the interface, into a submenu like notion has

I do agree, I could just remove the buttons. @gerdadesign any issues from your end if we remove the buttons? Maybe you could share what was the motivation of having them designed in the UI? Maybe we are missing some important details?

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Nov 12, 2022

  • I could find a strange behavior: when doing an undo or a redo, the sync state doesn't show correctly: It keeps saying "All changes saved". I don't know when my change is actually saved. So I don't know if I can leave the page or not.

    Screenshot 2022-11-12 at 22 54 41

@gerdadesign
Copy link
Member

I do agree, I could just remove the buttons. @gerdadesign any issues from your end if we remove the buttons? Maybe you could share what was the motivation of having them designed in the UI? Maybe we are missing some important details?

This seems fine. For context:

  • Tooljet shows undo and redo buttons in the UI
  • The more common pattern across Retool, Appsmith, and Openblocks seems to be not showing undo / redo buttons, but listing the keyboard shortcuts (and have a keyboard shortcut of ? to access the keyboard shorts list). They also show feedback for the action in the form of a small temporary banner.
  • I could not find the info for Superblocks

So, especially for a tech-fluent audience, I think that keyboard shortcut would suffice. This would probably require adding Keyboard shortcuts to the Help menu:
_HelpMenu

and then from there, showing the list of available keyboard shortcuts
_KeyboardShortcutsMenu (1)

@bytasv
Copy link
Contributor

bytasv commented Nov 29, 2022

I'm removing undo/redo buttons as part of #1308 👍

@Janpot
Copy link
Member

Janpot commented Feb 22, 2023

This has been implemented

@Janpot Janpot closed this as completed Feb 22, 2023
@github-project-automation github-project-automation bot moved this from Q1 2023 Jan-Mar to Future in MUI Toolpad public roadmap Feb 22, 2023
@prakhargupta1 prakhargupta1 moved this from Future to Q4 2022 Oct-Dec in MUI Toolpad public roadmap Mar 21, 2023
@oliviertassinari oliviertassinari added the scope: toolpad-studio Abbreviated to "studio" label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: App Editor new feature New feature or request scope: toolpad-studio Abbreviated to "studio"
Projects
Status: Completed
Development

No branches or pull requests

6 participants