-
Notifications
You must be signed in to change notification settings - Fork 19
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
Backend undo manager #384
Comments
Can we still register the undo manager front-end side for it to work in jupyterlite? |
Yes, they are unrelated.
I'm asking because @Meriem-BenIsmail could undo but not redo, when just adding |
Nope, the rendering logic is triggered on |
Hi, I can confirm as I encountered the same scenario in 383#comment My observation was that redo only works once that only reverts last undo operation, but not after that. |
Hi, when expanding the scope of the undo manager for the YJCad example like this |
One thing that could explain this behavior, is that JupyterCAD reacts to an undo operation by doing another operation on |
indeed, JupterCAD updates object metadata after rendering.
|
The redo stack behavior isn't the only issue here. Whenever the objects are updated, this method should be invoked. It gets called during the undo operation, but not during the redo. |
But no, |
It turns out the issue was indeed with |
I'm wondering if the undo manager should support this use case? |
No, it cannot support this use case. |
Here is how an object looks like. It's a standard
|
Thanks. |
Yes, the geometry properties are computed by Opencascade after rendering. Some other keys are defined at shape creation time. None are modifiable by users and there are no reactivities on these values. |
Well I don't know this project enough, but if a user action on an object leads to a change of the same object, then it cannot work with an undo manager (at least it's not possible to redo after an undo). |
can we detect the origin of the modification? if it is from the undo manager we can skip the metadata update since it's correct anyway. |
JupyterCAD needs OpenCascade in the frontend to compute these geometry properties, but we also want to have access to these properties from a kernel |
In any case, if all the data were stored under a shared type, separate from the metadata, we could add that shared type to the undo manager's scope. Do you think it's possible? |
yes, I thought about this solution but I feel more comfortable with the update origin approach since it's more natural to have the object metadata in the object itself. But we can use this solution as the last resort |
The metadata would still be in the object itself, but all the other (undoable) data would be under e.g. a |
The problem with that is that origins don't propagate through the network, so if the metadata update happens in the frontend, it won't solve @Meriem-BenIsmail's issue, and if the metadata update happens in the backend, it won't solve @arjxn-py's issue 😄 |
something like this could work ?
If it could, it's possible to update the shared model schema but I'm not sure about the amount of work. |
Yes I think it would work ( |
I can work on origins in |
if it's the same amount of work, yours would have a much greater impact 😺 |
As I said, it wouldn't work in all cases 🐭 |
@Meriem-BenIsmail could you test your undo manager with #385 to see if the redo works? |
@trungleduc I just tested #385 and both the undo and redo work perfectly ! |
In jupyter-ydoc v3 there will be an undo manager that will allow to undo/redo operations on a shared model in the backend in a document-agnostic way. Every document inheriting from
YBaseDoc
will be responsible for adding to the undo manager's scope the shared types that it wishes to be included. For instance, for aYNotebook
, the cells are included in the undo manager's scope.For a YJCad document, it looks like
self._yobjects
should be included?cc @Meriem-BenIsmail
The text was updated successfully, but these errors were encountered: