sortBy('sort', 'desc') changes page order in content folder

When using the following code in a page template, the folders corresponding to the children pages get re-ordered/re-numbered each time the page is loaded.

$page->children()->listed()->sortBy('sort', 'desc')

I realize the proper way to do this would be to use:

$page->children()->listed()->flip()

But it seemed wrong that this template logic was able to change the actual page order in the content folder.

Also you can use num attribute like that:

$page->children()->listed()->sortBy('num', 'desc')

yep, that would work too.

I was just flagging a possible bug that reorders pages in the content folder

Nevertheless, the pages should not be reordered when calling sortBy(), sounds like a bug to me.
Do you authenticate in the template or calling it as a logged in user?

Could you create an issue please, with exact description when this happens and with your code example? Thank you!

@texnixe I guess I was authenticating by being a logged in user. The code just triggers an error if logged out, so maybe less of an issue than I thought. I’ll still create an issue