v2-hub
v2-hub copied to clipboard
False positive duplicate IDs
Describe the bug
Sometimes when moving a page, the system will falsely think it's a duplicate, although the page only exist once. Clearing the cache will remove the false positive.
It might have something to do with stache_always_update: false
and multiple languages, but I'm not sure.
To Reproduce Steps to reproduce the behavior:
- Move pages around in CP until duplicate IDs occur.
- Clear cache when they do.
- See that the duplicate IDs have vanished.
Expected behavior False positives scare editors and should be avoided ;)
Environment details (please complete the following information):
- Statamic Version: 2.10.5
- OS: Alpine Linux 3.8
- Web Server: nginx
- PHP Version: 7.2
Did you move the page using drag/drop in the CP?
Yes, the editors don't have access to files in any way.
Just checking. You said move the pages but didn't say how. 👍
Ahhh... just updated to clarify :)
Did you remove a locale, perhaps?
Nope, the site settings are locked so they can't be changed outside of local development, and the issue occurs on the client's stage site. Might be related to #2163 - will most likely only occur on large sites like the content archive I sent to Jason.
I am getting this randomly on a single language site on 2.11.2 - it will flash up after a save i.e 28 duplicate IDs
. When I click the details of the duplicate IDs it lists 28 entries and all the 'duplicates' are the same entry, but listed twice each. Clearing the cache fixes it.
I have similar issue on single language site. Statamic 2.11.12.
Screencast: https://www.dropbox.com/s/jwmhnc9my40ytjp/statamic_2_11_12_reorderpages_bug.mov?dl=0
[2019-06-09 00:47:45] dev.ERROR: Cannot add [pages/6.test-2/index.md] to Stache repository [pagestructure]. File at [pages/1.about/3.test-2/index.md] already exists in repository [pages] with an ID of [e0afde8e-9735-4c09-b79b-447eb5886874].
[2019-06-09 00:51:13] dev.ERROR: Cannot add [pages/6.test-1/index.md] to Stache repository [pagestructure]. File at [pages/1.about/1.test-1/index.md] already exists in repository [pages] with an ID of [5083c5a1-a777-4114-8443-7dc9ef6811d7].
[2019-06-09 00:53:25] dev.ERROR: Cannot add [pages/6.about-test-1/index.md] to Stache repository [pagestructure]. File at [pages/1.about/1.about-test-1/index.md] already exists in repository [pages] with an ID of [eb8dce7c-0452-49a6-9600-c834c3b0b813].
[2019-06-09 00:54:26] dev.ERROR: Cannot add [pages/6.about-test-2/index.md] to Stache repository [pagestructure]. File at [pages/3.gallery/1.about-test-2/index.md] already exists in repository [pages] with an ID of [13b99e64-ec7f-4394-8b1b-e089ee9d296d].
We are also running into this issue. Note that this only seem to happen if the page being moved has been newly created before.
- Statamic
2.11.14
- 3 locales
-
stache_always_update
:false
Our fix is to clear the stache whenever pages are moved (not really an elegant or performant solution, but it works):
class MyAddonListener extends Listener
{
public $events = [
'Statamic\Events\Data\PagesReordered' => 'onPagesReordered'
];
public function onPagesReordered(PagesReordered $event)
{
// This is a workaround for the following bug: https://github.com/statamic/v2-hub/issues/2195
Stache::clear();
}
}
I have the same issue on a customer's site and can confirm @wanze 's findings: Duplicate IDs occur when the page order of a newly created page is changed.
- Statamic
2.11.14
- Just 1 locale (
de
only; noen
!) -
stache_always_update: false
was there a fix for this bug?