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

[v5] Running page save/update in after hook results in phantom unsaved changes notification #6869

Open
adamkiss opened this issue Dec 16, 2024 · 0 comments

Comments

@adamkiss
Copy link
Contributor

Description

If you need to change something in a page automatically - in my case auto-generate title based on other fields - it was always best to do so in a page.update:after hook. In v5-beta.1, the originating update is saved correctly, the hook is run (and change persisted), but the tracking system (sometimes) incorrectly keeps the page marked as changed (or re-marks, maybe?).

Sometimes the yellow buttons popup right away, sometimes after refresh, sometimes they don't pop up at all and page isn't marked changed.

I observe this pretty often (> 80%) when the page is saved with S, but trigger it slightly less (60%?) while saving by clicking the save button.

Expected behavior

  1. Page is saved
  2. Hook runs
  3. Page isn't marked by system as having changes

Screenshots

CleanShot.2024-12-16.at.22.27.28.mp4

To reproduce

  1. Have a bluprint marked with changeTitle: false
  2. Add following hook:
[
	'page.update:after' => function (Page $newPage)  {
		kirby()->impersonate('kirby');

		$p->save(['title' => 'Automatically changed title at '.time()]);

		kirby()->impersonate(null);
	}
]
  1. Update a page of that blueprint couple of times and observe mayhem.

Note: additionally, I don't remember having to release the kirby impersonate call before, but now it triggers the "other user is editing this page" popup.

Your setup

Kirby Version
v5-beta.1

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

1 participant