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

[GB 2.0 pre alpha] No undo when adding element to a container or when adding an inner container #1422

Open
quantumleap33 opened this issue Oct 31, 2024 · 2 comments
Assignees
Milestone

Comments

@quantumleap33
Copy link

Description

I've noticed that when adding an inner container inside an existing container or when adding an element to a container, the undo buttons do not work.

@quantumleap33 quantumleap33 added the triage Awaiting review label Oct 31, 2024
@iansvo iansvo added bug Bugs, unexpected and weird behaviors Medium Effort and removed triage Awaiting review labels Dec 3, 2024
@iansvo iansvo self-assigned this Dec 3, 2024
@iansvo iansvo added this to the 2.0.0 milestone Dec 3, 2024
@iansvo
Copy link
Collaborator

iansvo commented Dec 4, 2024

@tomusborne Happy to look at this, but do you have any thoughts on why this might be happening? If we're inserting or replacing blocks I would expect the native undo would work as expected here.

I've also observed this same issue myself during my recent project and we 100% should fix it before releasing 2.0.

@tomusborne
Copy link
Owner

tomusborne commented Dec 10, 2024

What you're experiencing here is core "undoing" the uniqueId generation for the block.

So, the undo is working, it's just undoing something that happened in the background.

If you undo twice, it will remove the added Container.

I'm not really sure if there's a way around this, as we need to generate a unique ID for each block added to the page.

One option is to use the __unstableMarkNextChangeAsNotPersistent() function before we set the ID, but I don't love using "unstable" functions provided by core.

@tomusborne tomusborne added discussion and removed bug Bugs, unexpected and weird behaviors Medium Effort labels Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants