@@ -37,6 +37,7 @@ type ActiveProviderUpdateToast =
3737 readonly key : string ;
3838 readonly toastId : ProviderUpdateToastId ;
3939 readonly canManageProviders : boolean ;
40+ readonly canUpdateProviders : boolean ;
4041 }
4142 | {
4243 readonly kind : "update" ;
@@ -109,6 +110,8 @@ export function ProviderUpdatePrimaryNotification() {
109110 primaryEnvironment ?. environmentId ?? null ,
110111 AuthProvidersManageScope ,
111112 ) ;
113+ const canUpdateProviders =
114+ canManageProviders && primaryEnvironment ?. connection . phase === "connected" ;
112115 const updateProvider = useAtomCommand ( serverEnvironment . updateProvider , {
113116 reportFailure : false ,
114117 } ) ;
@@ -179,7 +182,8 @@ export function ProviderUpdatePrimaryNotification() {
179182 const updateExistingPrompt =
180183 activeToast ?. kind === "prompt" &&
181184 activeToast . key === notificationKey &&
182- activeToast . canManageProviders !== canManageProviders ;
185+ ( activeToast . canManageProviders !== canManageProviders ||
186+ activeToast . canUpdateProviders !== canUpdateProviders ) ;
183187 if (
184188 ! notificationKey ||
185189 dismissedNotificationKeys . has ( notificationKey ) ||
@@ -204,7 +208,7 @@ export function ProviderUpdatePrimaryNotification() {
204208 if (
205209 updateStarted ||
206210 oneClickProviders . length === 0 ||
207- ! primaryEnvironment ||
211+ primaryEnvironment ?. connection . phase !== "connected" ||
208212 ! readEnvironmentScope ( primaryEnvironment . environmentId , AuthProvidersManageScope )
209213 ) {
210214 return ;
@@ -291,7 +295,7 @@ export function ProviderUpdatePrimaryNotification() {
291295 oneClickProviders . length > 0
292296 ? {
293297 children : "Update" ,
294- disabled : ! canManageProviders ,
298+ disabled : ! canUpdateProviders ,
295299 onClick : runUpdates ,
296300 }
297301 : {
@@ -323,9 +327,16 @@ export function ProviderUpdatePrimaryNotification() {
323327 } else {
324328 toastId = toastManager . add ( toastOptions ) ;
325329 }
326- activeToastRef . current = { kind : "prompt" , key : notificationKey , toastId, canManageProviders } ;
330+ activeToastRef . current = {
331+ kind : "prompt" ,
332+ key : notificationKey ,
333+ toastId,
334+ canManageProviders,
335+ canUpdateProviders,
336+ } ;
327337 } , [
328338 canManageProviders ,
339+ canUpdateProviders ,
329340 updateProvider ,
330341 dismissNotificationKey ,
331342 dismissedNotificationKeys ,
0 commit comments