@@ -513,9 +513,32 @@ export const FeedList = ({
513513 const { mainnet, testnet } = availableNetworkTypes
514514
515515 if ( selectedNetworkType === "mainnet" && ! mainnet && testnet ) {
516+ console . log ( "Auto-switching from mainnet to testnet (mainnet not available)" )
516517 setSelectedNetworkType ( "testnet" )
518+
519+ // Update URL parameters to reflect the auto-switch
520+ if ( typeof window !== "undefined" ) {
521+ const params = new URLSearchParams ( window . location . search )
522+ params . set ( "networkType" , "testnet" )
523+ if ( ! params . get ( "testnetPage" ) ) {
524+ params . set ( "testnetPage" , "1" )
525+ }
526+ params . delete ( "testnetSearch" ) // Clear any previous testnet search
527+ const newUrl = window . location . pathname + "?" + params . toString ( )
528+ window . history . replaceState ( { path : newUrl } , "" , newUrl )
529+ }
517530 } else if ( selectedNetworkType === "testnet" && ! testnet && mainnet ) {
531+ console . log ( "Auto-switching from testnet to mainnet (testnet not available)" )
518532 setSelectedNetworkType ( "mainnet" )
533+
534+ // Update URL parameters to reflect the auto-switch
535+ if ( typeof window !== "undefined" ) {
536+ const params = new URLSearchParams ( window . location . search )
537+ params . delete ( "networkType" )
538+ params . delete ( "testnetSearch" )
539+ const newUrl = window . location . pathname + "?" + params . toString ( )
540+ window . history . replaceState ( { path : newUrl } , "" , newUrl )
541+ }
519542 }
520543 }
521544 } , [
0 commit comments