@@ -83,14 +83,14 @@ export interface ConfigPageProps extends React.HTMLProps<HTMLElement> {
8383
8484// Config Page can be loaded either as a page or as a component in the landing helper-ui page
8585const ConfigPage : FunctionComponent < ConfigPageProps > = ( ) => {
86- const { setConfig, resetConfig, gateways, routers, dnsJsonResolvers, debug, enableGatewayProviders, enableRecursiveGateways, enableWss, enableWebTransport, fetchTimeout, isLoading : isConfigDataLoading } = useContext ( ConfigContext )
86+ const { setConfig, resetConfig, gateways, routers, dnsJsonResolvers, debug, enableGatewayProviders, enableRecursiveGateways, enableWss, enableWebTransport, fetchTimeout, serviceWorkerRegistrationTTL , isLoading : isConfigDataLoading } = useContext ( ConfigContext )
8787 const [ isSaving , setIsSaving ] = useState ( false )
8888 const [ error , setError ] = useState < Error | null > ( null )
8989 const [ resetKey , setResetKey ] = useState ( 0 )
9090
9191 const saveConfig = useCallback ( async ( ) => {
9292 try {
93- const config = { gateways, routers, dnsJsonResolvers, debug, enableGatewayProviders, enableRecursiveGateways, enableWss, enableWebTransport, fetchTimeout }
93+ const config = { gateways, routers, dnsJsonResolvers, debug, enableGatewayProviders, enableRecursiveGateways, enableWss, enableWebTransport, fetchTimeout, serviceWorkerRegistrationTTL }
9494 setIsSaving ( true )
9595 await storeConfig ( config , uiComponentLogger )
9696 log . trace ( 'config-page: sending RELOAD_CONFIG to service worker' )
@@ -104,7 +104,7 @@ const ConfigPage: FunctionComponent<ConfigPageProps> = () => {
104104 } finally {
105105 setIsSaving ( false )
106106 }
107- } , [ gateways , routers , dnsJsonResolvers , debug , enableGatewayProviders , enableRecursiveGateways , enableWss , enableWebTransport , fetchTimeout ] )
107+ } , [ gateways , routers , dnsJsonResolvers , debug , enableGatewayProviders , enableRecursiveGateways , enableWss , enableWebTransport , fetchTimeout , serviceWorkerRegistrationTTL ] )
108108
109109 const doResetConfig = useCallback ( async ( ) => {
110110 // we need to clear out the localStorage items and make sure default values are set, and that all of our inputs are updated
@@ -207,6 +207,21 @@ const ConfigPage: FunctionComponent<ConfigPageProps> = () => {
207207 onChange = { ( value ) => { setConfig ( 'fetchTimeout' , value ) } }
208208 resetKey = { resetKey }
209209 />
210+ < NumberInput
211+ className = 'e2e-config-page-input e2e-config-page-input-serviceWorkerRegistrationTTL'
212+ description = 'The time for the service worker registration to last, in hours, prior to triggering an explicit unregister event.'
213+ label = 'Service Worker Registration TTL'
214+ value = { serviceWorkerRegistrationTTL / 1000 / 60 / 60 }
215+ validationFn = { ( value ) => {
216+ if ( value < 0.01 ) {
217+ return new Error ( 'Service worker registration TTL must be at least 0.01 hours' )
218+ }
219+ return null
220+ } }
221+ preSaveFormat = { ( value ) => value * 1000 * 60 * 60 }
222+ onChange = { ( value ) => { setConfig ( 'serviceWorkerRegistrationTTL' , value ) } }
223+ resetKey = { resetKey }
224+ />
210225 < TextInput
211226 className = 'e2e-config-page-input e2e-config-page-input-debug'
212227 description = "A string that enables debug logging. Use '*,*:trace' to enable all debug logging."
0 commit comments