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

Bugfix/224 undo and nested entries #228

Merged
merged 9 commits into from
May 14, 2024

Conversation

i-just
Copy link
Contributor

@i-just i-just commented May 14, 2024

Description

Scenario 1:
When you just created a nested entry in the CKEditor field, delete it, wait for autosave to complete, and use undo to bring it back.

In the above scenario, the nested entry has already been soft deleted, so when you undo it, you get a card with an “Invalid entry ID” message. If you then refresh the page, the card shows correctly because the soft-deleted entry has been restored. I don’t see a way to detect if the undo command has been fired before editing downcast completes, so this is the only way I can think of to fix the issue.

Scenario 2:
Add a nested entry to the CKEditor field, save the parent entry, delete the nested element, wait for autosave to complete, use undo to bring it back and save the parent entry again - once the page reloads, the nested entry card is rendered as deleted (it’ll show as deleted with the fix for scenario 1 in place; without it it’ll show as invalid entry id).

It was happening because the ownership info was deleted the moment the nested entry was deleted, and it was not brought back on undo. Ensuring the ownership data is stored when downcasting the craftEntryModel ensures all following queries work as expected and the nested entry isn’t soft-deleted.

Related issues

#224

@i-just i-just requested a review from brandonkelly as a code owner May 14, 2024 13:53
@brandonkelly brandonkelly merged commit 58be114 into 4.x May 14, 2024
@brandonkelly brandonkelly deleted the bugfix/224-undo-and-nested-entries branch May 14, 2024 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants