Programatically create page and using a field immediately fails

this is more or less a revive of an old post of mine and @texnixe.

$newuri = 'hello-'.time();
$data = ['title'=>$newuri, 'text'=>'hello'];
$new = site()->pages()->create($newuri, 'default', $data);

echo '['.$new->text()->value().']'; // empty? Κ•γƒŽβ€’α΄₯β€’Κ”γƒŽ οΈ΅ ┻━┻

// probably a hook or other plugin kicked in. lets fix that.
$new->reset(); // (๑‒̀ㅂ‒́)و✧

// if you need page models right now you will have to follow these instructions
// https://forum.getkirby.com/t/call-page-model-in-panel-field/7179/2

echo '{'.$new->text()->value().'}'; // now it works

I can’t reproduce this. For me, each echo returns something without the reset. Are you using any plugins? I had a similar problem in the past where the Modules plugin was causing a similar problem.

sry i just found the solution for my problem and change a lot of text. i will try with an clean kirby and report back.

Yeah, I just realized that, but if it works with reset()…

yes i have a lot of plugins and some hooks. but i am not using the modules plugin.
it works without reset() on clean install like you said.
i could not quickly find responsible plugin/hook.

page models are not loaded either. needed to get them back myself (see above). but this time i am not even creating pages from the panel. it fails in frontend.
maybe someone from kirby team could check the return value of the page create function with page-models, hooks and plugins in mind.

What do you mean with creating pages from the Panel? I thought this was about creating pages from the frontend anyway?

the link i added in the code above refers to getting page model in hooks or panel. and yes – i am creating a page in frontend but i comes back without the page-model anyway. so i had to get it myself.