I’ve tested it some more now in the panel.
If I write some content that I don’t save and then refresh the browser it says:
You have unsaved changes!
So far so good. It does not save my content because I did not press “Save”. I change my template, still with unsaved content.
Now it looks like it saved the data as well because the green smiley showed up and the message is gone. By looking at the
title afterwards it seems to have saved the old content again, not the session/changed content.
My guess is that it destroys the session on template change and that the page updates to how the page was before the refresh, only to keep the page object updated.
In a plugin I’m working on I renamed a content textfile and then tried to get the new page template with
page('a-page')->template() but it always showed me the old page object (template) before I renamed the file. I guess it uses some kind of cache. A page update triggered by the plugin there would probably solve the problem, just to keep the page object up to date.
(Many guesses in this post)
Personally I hope Kirby handles this a bit more elegantly in the future. Like keeping the session all the time until I press save and on change template, only change the template, not save the page.