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 #69

Closed
brauliodiez opened this issue Jul 26, 2024 · 0 comments · Fixed by #177
Closed

Undo / Redo #69

brauliodiez opened this issue Jul 26, 2024 · 0 comments · Fixed by #177
Assignees

Comments

@brauliodiez
Copy link
Member

brauliodiez commented Jul 26, 2024

Cannot be implemented til we don't have global context

We can follow same approach as in Mongo Modeler and reuse undo/redo helpers

More info about MongoModeler, you can take this files from the following path:

https://github.com/Lemoncode/mongo-modeler/tree/vnext/src/common/undo-redo

About how it works:

  • Whenever we perform any operation on the shape list, we just call addSnapshot.
  • Whenever we want to undo a given action, we can call Undo.
  • Same to redo
  • And we can check if something can be undone or not by using the flags.

Usage in Mongo Modeler:

https://github.com/Lemoncode/mongo-modeler/blob/vnext/src/core/providers/canvas-schema/canvas-schema.provider.tsx

In order to avoid having to call addSnapshot on very operation, we have implemented another hook: useStateWithInterceptor

https://github.com/Lemoncode/mongo-modeler/blob/vnext/src/core/providers/canvas-schema/canvas-schema.hook.tsx

This allows use to implement something like:

  // TODO: consider moving all these to useReducer (discuss first if needed)
  // #54 created to track this
  // https://github.com/Lemoncode/mongo-modeler/issues/54
  const [canvasSchema, setSchema, setSchemaSkipHistory] =
    useStateWithInterceptor(createDefaultDatabaseSchemaVm(), addSnapshot);

We can have a session to get started with this task

@brauliodiez brauliodiez moved this to Locked in QuickMock Jul 26, 2024
@brauliodiez brauliodiez moved this from Locked to Backlog in QuickMock Jul 29, 2024
@raquetelio raquetelio self-assigned this Jul 30, 2024
@brauliodiez brauliodiez moved this from Backlog to In Progress in QuickMock Jul 31, 2024
brauliodiez added a commit that referenced this issue Aug 12, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in QuickMock Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants