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

Site index also lists old version of page in page.changeSlug:after hook #1952

Closed
qwerdee opened this issue Jul 29, 2019 · 3 comments

Comments

@qwerdee
Copy link

commented Jul 29, 2019

Describe the bug
When hooking into the page.changeSlug:after hook the site index lists two versions of the page, one with old id and one with new id.

'page.changeSlug:after' => function() {
  // lists two versions of the page, one with old and one with new id
  $this->site()->index();
 },

Expected behavior
In the moment of triggering the hook the index should only list valid pages, therefore not the version of the page with an old id.

Additional context
Might be related to #1923

Kirby Version
3.2.2

@texnixe

This comment has been minimized.

Copy link
Contributor

commented Jul 29, 2019

The hook function has two parameters ($oldpage, $newpage), so I would expect the two objects to be still available.

@qwerdee

This comment has been minimized.

Copy link
Author

commented Jul 30, 2019

Right, however as the old page model is passed as a parameter, I see no need to have it also present in the index collection. I still expect this to represent the valid state of the site after the slug change happened.
My fix for now is to manually remove the old page from the collection.

@bastianallgeier

This comment has been minimized.

Copy link
Contributor

commented Sep 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.