v2-hub icon indicating copy to clipboard operation
v2-hub copied to clipboard

False positive duplicate IDs

Open FrittenKeeZ opened this issue 6 years ago • 11 comments

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:

  1. Move pages around in CP until duplicate IDs occur.
  2. Clear cache when they do.
  3. 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

FrittenKeeZ avatar Oct 09 '18 13:10 FrittenKeeZ

Did you move the page using drag/drop in the CP?

jasonvarga avatar Oct 09 '18 13:10 jasonvarga

Yes, the editors don't have access to files in any way.

FrittenKeeZ avatar Oct 09 '18 13:10 FrittenKeeZ

Just checking. You said move the pages but didn't say how. 👍

jasonvarga avatar Oct 09 '18 13:10 jasonvarga

Ahhh... just updated to clarify :)

FrittenKeeZ avatar Oct 09 '18 13:10 FrittenKeeZ

Did you remove a locale, perhaps?

jackmcdade avatar Oct 31 '18 20:10 jackmcdade

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.

FrittenKeeZ avatar Nov 01 '18 08:11 FrittenKeeZ

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.

dannyuk1982 avatar Nov 29 '18 10:11 dannyuk1982

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].

luizboaretto avatar Jun 09 '19 04:06 luizboaretto

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();
    }
}

wanze avatar Aug 29 '19 07:08 wanze

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; no en!)
  • stache_always_update: false

pxmch avatar Sep 30 '19 21:09 pxmch

was there a fix for this bug?

matuvu avatar Nov 16 '21 14:11 matuvu