The lockscreen or turning the screen off turns off network shared through the hotspot. On-device network seems to work fine since the locking doesn’t affect spotify media play. I’ve tried USB tethering which too works fine with the device locked.
Tried restarting, and resetting the network and wifi settings, but results are the same. Also tried toggling through various network, data, and connection settings, even ones in the developer options, but got nothing.
The issue is irritating when working with other devices and using my Nothing phone as a hotspot. The connection resumes at the moment the screen is awake. Although the WiFi itself works fine when connected to other hotspot networks. So I guess the problem is not with connection, but rather with the device lockscreen or sleep settings.