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

Duplicated entries do not get appended to tree file when parent is root #11319

Open
Boefjim opened this issue Jan 7, 2025 · 0 comments · May be fixed by #11320
Open

Duplicated entries do not get appended to tree file when parent is root #11319

Boefjim opened this issue Jan 7, 2025 · 0 comments · May be fixed by #11320

Comments

@Boefjim
Copy link

Boefjim commented Jan 7, 2025

Bug description

When creating a entry within a structured collection, it is automatically added to the correspondig tree YAML file.
When duplicating an entry within a structured collection, it is not automatically added to the correspondig tree YAML file.
This only seems to happen when the parent entry is the root entry of the structure.

While it may look like the duplicated entry is part of the tree (it shows up in the admin tree UI and shows the root entry as it's parent field value), it is not actually stored within the tree YAML file.
This causes an issue where the parent cannot be updated by unlinking the root entry and linking a different entry.

How to reproduce

  1. Setup a project with Statamic
  2. Create a structured collection "test"
  3. Create a blueprint for the collection with title & parent fields
  4. Create a root entry "root"
  5. Create an entry "new parent"
  6. Create an entry "duplication source"
  7. Duplicate the "duplication source" entry (rename it "duplication target").
  8. Notice how this entry is not present in content/trees/collections/test.yml
  9. Go to the "duplication target" entry
  10. Unlink the "root" parent
  11. Link the parent to "new parent"
  12. Save changes
  13. Notice that the parent is still "root"

Logs

No response

Environment

Environment
Application Name: Laravel
Laravel Version: 10.48.24
PHP Version: 8.2.25
Composer Version: 2.8.2
Environment: local
Debug Mode: ENABLED
URL: localhost
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: stack / single
Mail: smtp
Queue: redis
Session: file

Sentry
Enabled: MISSING DSN
Environment: local
Laravel SDK Version: 3.8.2
PHP SDK Version: 3.22.1
Release: NOT SET
Sample Rate Errors: 100%
Sample Rate Performance Monitoring: NOT SET
Sample Rate Profiling: NOT SET
Send Default PII: DISABLED

Statamic
Addons: 4
Sites: 3 (United States, Canada (EN), Canada (FR))
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.41.0 PRO

Statamic Addons
mitydigital/statamic-two-factor: 2.3.0
statamic/eloquent-driver: 4.18.0
stoffelio/statamic-404-logger: 1.1.0
superinteractive/statamic-super-link: 1.0.1

Statamic Eloquent Driver
Asset Containers: file
Assets: eloquent
Blueprints: file
Collection Trees: file
Collections: file
Entries: eloquent
Forms: eloquent
Global Sets: eloquent
Global Variables: file
Navigation Trees: file
Navigations: eloquent
Revisions: eloquent
Sites: file
Taxonomies: file
Terms: eloquent
Tokens: file

Installation

Existing Laravel app

Additional details

No response

@Boefjim Boefjim changed the title Duplicated entries do not get added to tree Duplicated entries do not get added to tree file Jan 7, 2025
@Boefjim Boefjim changed the title Duplicated entries do not get added to tree file Duplicated entries do not get added to tree file when parent is root Jan 7, 2025
@Boefjim Boefjim changed the title Duplicated entries do not get added to tree file when parent is root Duplicated entries do not get appended to tree file when parent is root Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant