Umbraco-CMS icon indicating copy to clipboard operation
Umbraco-CMS copied to clipboard

Fix: Infinite Editor creates each save action a new version when content is invalid (#12713)

Open ealse opened this issue 2 years ago • 1 comments

Prerequisites

  • [x] I have added steps to test this contribution in the description below

If there's an existing issue for this PR then this fixes #12713

Description

When a node is created with the infinite editor and a required field is not filled in, every save action creates a new node.

Cause: Because the save action contains invalid content the status code 400 is returned, but it has created a content node. This is ok, but as result of the status code 400 the code below in the edit.controller.js file is not excecuted.

// must be set manually for infinite edit mode
$scope.page.isNew = false;

Solution: If an error occurs and there is a content node created then the content id is set. At that point, the scope.isNew must also be adjusted to false

Specifics

https://user-images.githubusercontent.com/50272817/179773073-9cf392c7-31c0-47fc-a733-1e1a4d83543d.mp4

Steps to reproduce

  • Create a clean Umbraco install following the guide (https://our.umbraco.com/documentation/Fundamentals/Setup/Install/)
  • Create a documenttype with a listview that has enabled the Infinite Editor and add a new documenttype below it.
  • Create in the Content section a new listview item.
  • And click as many times you want on the save button.

ealse avatar Aug 22 '22 10:08 ealse

Hi there @ealse, thank you for this contribution! 👍

While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:

  • It's clear what problem this is solving, there's a connected issue or a description of what the changes do and how to test them
  • The automated tests all pass (see "Checks" tab on this PR)
  • The level of security for this contribution is the same or improved
  • The level of performance for this contribution is the same or improved
  • Avoids creating breaking changes; note that behavioral changes might also be perceived as breaking
  • If this is a new feature, Umbraco HQ provided guidance on the implementation beforehand
  • [x] 💡 The contribution looks original and the contributor is presumably allowed to share it

Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution.

If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

github-actions[bot] avatar Aug 22 '22 10:08 github-actions[bot]

In our project we work with custom dashboards and are therefore also bound to the Infinite Editor. I don't think there is a simple/quick workaround for this bug. And the solution is important to release our project. So I was curious what I can do to make sure it can be included in the next release or what time indication can be given to merge this issue.

@nul800sebastiaan do you think can you answer this or let me know how I can contribute further?

ealse avatar Sep 26 '22 10:09 ealse

Hey there @ealse and many apologies for the late response. I finally had a look at reproducing the issue and found that indeed when you're editing list view items in infinite editing mode (I learned that this is an option now, learn something new every day! 🎉 ) that indeed this is not working great when you save a single item multiple times.

This fix is great and indeed prevents the issue, thank you so much!

nul800sebastiaan avatar Mar 27 '23 09:03 nul800sebastiaan

Cherry picked for 10.6 as well in 40285b76b994862d06aa38d79699e3eb1e18dfdd

nul800sebastiaan avatar Mar 27 '23 09:03 nul800sebastiaan