I didn’t find find an issue ticket on contacts github.
Is there any work on this issue at the moment?
As @jbyvosges, I can confirm contacts behaviour and have some additional information from my personal situation. In my system, I use Nextcloud 17.0.2 and contacts 3.1.8. The default sorting is “display name” all the time. If I change sorting to “last name”, this sorting is valid until I logout as user from Nextcloud. When I log in again sorting is “display name” again, even if browser window is not closed.
As @j-ed asked to look after Cookie setting, I can confirm, that my Nextcloud domain is whitelisted in my Firefox browser 72 in Preferences/Cookie settings and I checked, that cookies are not deleted when Browser is closed, although issue also happens when Browser is not closed.
If there is more and detailed information necessary, I can provide, if requested.
I checked sorting with new browser (Chrome) and saved cookies but also in this constellation it is not possible to configure default sorting with “last name”. After serveral tests my conclusion is that either the cookie settings according to @j-ed are not sufficient or @j-ed is wrong and there still is a bug in contacts app.
If there is anything I can further test, any hint is appreciated.