I've just spent some time to re-test and am sure the example is working OK as intended. It's possibly you're using the different, not-yet-fixed or modified version of it.
If you experience something different, it's a good opportunity for you to read the code / examples to get deeper understanding of the library.
I'm sorry I won't spend more time on the same issue until convincing proof of bug is provided.
Hereafter are the debug terminal outputs to show you it's currently working OK
1. Start with static IP 192.168.2.188
Starting ConfigOnSwichFS_MQTT_Ptr using LittleFS on ESP8266_NODEMCU
ESP_WiFiManager v1.4.2
{"AIO_SERVER_Label":"io.adafruit.com","AIO_SERVERPORT_Label":"1883","AIO_USERNAME_Label":"user_name","AIO_KEY_Label":"aio_key"}
Config File successfully parsed
{"AIO_SERVER_Label":"io.adafruit.com","AIO_SERVERPORT_Label":"1883","AIO_USERNAME_Label":"user_name","AIO_KEY_Label":"aio_key"}
Config File successfully parsed
[WM] LoadWiFiCfgFile
[WM] OK
[WM] stationIP = 192.168.2.188 , gatewayIP = 192.168.2.1 <=== Previously set @ 192.168.2.188
[WM] netMask = 255.255.255.0
[WM] dns1IP = 192.168.2.1 , dns2IP = 8.8.8.8
[WM] * Add SSID = HueNet1 , PW = 12345678
[WM] * Add SSID = HueNet2 , PW = 12345678
ConnectMultiWiFi in setup
[WM] ConnectMultiWiFi with :
[WM] * Additional SSID = HueNet1 , PW = 12345678
[WM] * Additional SSID = HueNet2 , PW = 12345678
[WM] Connecting MultiWifi...
[WM] WiFi connected after time: 1
[WM] SSID: HueNet1 ,RSSI= -45
[WM] Channel: 2 ,IP address: 192.168.2.188
W
Creating new WiFi client object : OK
Creating new MQTT object : OK
AIO_SERVER = io.adafruit.com, AIO_SERVERPORT = 1883
AIO_USERNAME = user_name, AIO_KEY = aio_key
Creating new MQTT_Pub_Topic, Temperature = user_name/feeds/Temperature
Creating new Temperature object : OK
Temperature MQTT_Pub_Topic = user_name/feeds/Temperature
Connecting to WiFi MQTT (3 attempts)...
WiFi MQTT connection successful!
TWWWW WTW
Button clicked!
2. SW pressed and entering CP, then input new static IP 192.168.2.189
Config Portal requested.
[WM] RFC925 Hostname = ConfigOnSwitchFS-MQTT
Opening Configuration Portal. Got stored Credentials. Timeout 120s
[WM] Adding parameter AIO_SERVER_Label
[WM] Adding parameter AIO_SERVERPORT_Label
[WM] Adding parameter AIO_USERNAME_Label
[WM] Adding parameter AIO_KEY_Label
[WM] setSTAStaticIPConfig for USE_CONFIGURABLE_DNS
[WM] Set CORS Header to : Your Access-Control-Allow-Origin
[WM] WiFi.waitForConnectResult Done
[WM] SET AP_STA
[WM] Configuring AP SSID = ESP_705385
[WM] AP PWD = your_password
[WM] AP Channel = 11
[WM] AP IP address = 192.168.4.1
[WM] HTTP server started
[WM] ESP_WiFiManager::startConfigPortal : Enter loop
[WM] Connecting to new AP
[WM] Already connected. Bailing out.
Connected...yeey :)
Local IP: 192.168.2.188
[WM] * Add SSID = HueNet1 , PW = 12345678
[WM] * Add SSID = HueNet2 , PW = 12345678
[WM] getSTAStaticIPConfig
[WM] stationIP = 192.168.2.189 , gatewayIP = 192.168.2.1 <==== New staticIP @ 192.168.2.189
[WM] netMask = 255.255.255.0
[WM] dns1IP = 192.168.2.1 , dns2IP = 8.8.8.8
[WM] SaveWiFiCfgFile
[WM] OK
Saving Config File
{
"AIO_SERVER_Label": "io.adafruit.com",
"AIO_SERVERPORT_Label": "1883",
"AIO_USERNAME_Label": "user_name",
"AIO_KEY_Label": "aio_key"
}
Config File successfully saved
Deleting old MQTT object
Deleting old Temperature object
Creating new MQTT object : OK
AIO_SERVER = io.adafruit.com, AIO_SERVERPORT = 1883
AIO_USERNAME = user_name, AIO_KEY = aio_key
Creating new MQTT_Pub_Topic, Temperature = user_name/feeds/Temperature
Creating new Temperature object : OK
Temperature MQTT_Pub_Topic = user_name/feeds/Temperature
[WM] freeing allocated params!
WTW
3. After reboot, still static IP 192.168.2.189
Starting ConfigOnSwichFS_MQTT_Ptr using LittleFS on ESP8266_NODEMCU
ESP_WiFiManager v1.4.2
{"AIO_SERVER_Label":"io.adafruit.com","AIO_SERVERPORT_Label":"1883","AIO_USERNAME_Label":"user_name","AIO_KEY_Label":"aio_key"}
Config File successfully parsed
{"AIO_SERVER_Label":"io.adafruit.com","AIO_SERVERPORT_Label":"1883","AIO_USERNAME_Label":"user_name","AIO_KEY_Label":"aio_key"}
Config File successfully parsed
[WM] LoadWiFiCfgFile
[WM] OK
[WM] stationIP = 192.168.2.189 , gatewayIP = 192.168.2.1
[WM] netMask = 255.255.255.0
[WM] dns1IP = 192.168.2.1 , dns2IP = 8.8.8.8
[WM] * Add SSID = HueNet1 , PW = 12345678
[WM] * Add SSID = HueNet2 , PW = 12345678
ConnectMultiWiFi in setup
[WM] ConnectMultiWiFi with :
[WM] * Additional SSID = HueNet1 , PW = 12345678
[WM] * Additional SSID = HueNet2 , PW = 12345678
[WM] Connecting MultiWifi...
[WM] WiFi connected after time: 1
[WM] SSID: HueNet1 ,RSSI= -40
[WM] Channel: 2 ,IP address: 192.168.2.189 <==== New staticIP @ 192.168.2.189 after reset
W
Creating new WiFi client object : OK
Creating new MQTT object : OK
AIO_SERVER = io.adafruit.com, AIO_SERVERPORT = 1883
AIO_USERNAME = user_name, AIO_KEY = aio_key
Creating new MQTT_Pub_Topic, Temperature = user_name/feeds/Temperature
Creating new Temperature object : OK
Temperature MQTT_Pub_Topic = user_name/feeds/Temperature
Connecting to WiFi MQTT (3 attempts)...
WiFi MQTT connection successful!
TWWWW WTWWWW WW