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

Template Handler can result in complete template deletion and re-creation. #656

Closed
NikRimington opened this issue Aug 6, 2024 · 1 comment

Comments

@NikRimington
Copy link
Contributor

Describe the bug
If your list of changes includes a deletion of "master" template and the change of a "selected master template" on another template the template is deleted and re-created.

E.g. If the starting data setup looks like this:

  • Master A
    • Template 1
    • Template 2
  • Master B
    • Template 3
    • Template 4

And you make the changes in the back office to put the templates like this:

  • Master A
    • Template 1
    • Template 2
    • Template 3 (moved)
    • Template 4 (moved)
  • Master B (deleted)

When you import the updated uSync files into a destination site, the Delete of Master B will happen first, as a result Templates 3 and 4 are deleted and then re-created giving them new ID's. Any documents that use Templates 3 / 4 will now be broken as they are looking for the old ID.

To Reproduce

  1. Create a v13 (latest) site including the clean starter kit and the latest V13 compatible uSync
  2. Log into the back office
  3. Create a new template call "Master Temp"
  4. Update the Article template to set it's Master template to "Master Temp"
  5. Stop the site and duplicate it
  6. Run the duplicate site to verify it works and the article pages are working correctly - alternatively, open the DB and confirm the ID of the Article template.
  7. Run the first site and go back to the "settings" section of Umbraco
  8. Move the Article template to be a child of the original Master template
  9. Delete the Master Temp template
  10. Stop the site and copy the usync files for Templates, into the duplicated site
  11. Run the duplicated site
  12. Perform a uSync import
  13. Open the DB and verify that the ID of the Article template is now different - additionally article pages will now be broken unless they get an explicit save and publish

Expected behavior
I would expect templates that have been moved from under the master being deleted to be moved before the deletion occurs.

Additional context
This is a non-recoverable error if the site is large with content in various states as the pages impacted by the deletion could have a published version different to the current draft version.

If the templates aren't using the Parent Child relationship in the back office, they appear to be safe.

henryjump added a commit to henryjump/uSync that referenced this issue Aug 7, 2024
KevinJump pushed a commit that referenced this issue Aug 7, 2024
KevinJump added a commit that referenced this issue Aug 28, 2024
* Allow for the creation of clean files at the root level.

* fixes #656 moved deletes to the end (#657)

also corrected a typo

* moved more deletes to end of process (#658)

* ignore examples

---------

Co-authored-by: Henry Jump <[email protected]>
@KevinJump
Copy link
Owner

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

No branches or pull requests

2 participants