To clarify, what I'm doing:
I'm connected to my ESPs WiFi (a setup WiFi network), which is in STATIONAP mode. My ESP is hosting a small webserver, which I'm accessing in my browser. In that browser, I enter data for connecting the ESP to my main home WiFi network. When I hit the save button, the data is sent to the ESP, which then uses it in wifi.sta.config() and wifi.sta.connect() to connect to the network. At this point, the ESP is still in STATIONAP mode. However, the webpage in my browser is now completely dead. According to my PC, I'm still connected to the ESPs setup WiFi network, but the page doesn't do anything anymore. Even refreshing the page gives me a ERR_CONNECTION_TIMED_OUT error. If I manually disconnect and reconnect to the ESPs setup WiFi network, the page refreshes perfectly fine again.
What it seems like to me, is that connecting to an AP with wifi.sta.connect() messes with any current wifi.ap connection. Is there any way to prevent wifi.ap connections from being lost when using wifi.sta.connect()?