diff --git a/app/pages/project/instances/InstancesPage.tsx b/app/pages/project/instances/InstancesPage.tsx index 9af371b8d..9fce0627a 100644 --- a/app/pages/project/instances/InstancesPage.tsx +++ b/app/pages/project/instances/InstancesPage.tsx @@ -223,7 +223,7 @@ export function InstancesPage() { instance={resizeInstance} project={project} onDismiss={() => setResizeInstance(null)} - onSuccess={() => apiQueryClient.invalidateQueries('instanceList')} + onListView /> )} diff --git a/app/pages/project/instances/instance/InstancePage.tsx b/app/pages/project/instances/instance/InstancePage.tsx index 03a092962..6a892136c 100644 --- a/app/pages/project/instances/instance/InstancePage.tsx +++ b/app/pages/project/instances/instance/InstancePage.tsx @@ -237,7 +237,6 @@ export function InstancePage() { instance={instance} project={instanceSelector.project} onDismiss={() => setResizeInstance(false)} - onSuccess={() => apiQueryClient.invalidateQueries('instanceView')} /> )} @@ -248,18 +247,30 @@ export function ResizeInstanceModal({ instance, project, onDismiss, - onSuccess, + onListView = false, }: { instance: Instance project: string onDismiss: () => void - onSuccess: () => void + onListView?: boolean }) { const instanceUpdate = useApiMutation('instanceUpdate', { onSuccess(_updatedInstance) { - onSuccess() + if (onListView) { + apiQueryClient.invalidateQueries('instanceList') + } else { + apiQueryClient.invalidateQueries('instanceView') + } onDismiss() - addToast({ title: 'Instance resized' }) + addToast({ + content: `${instance.name} has been resized`, + cta: onListView + ? { + text: `View instance`, + link: pb.instance({ project, instance: instance.name }), + } + : undefined, // Only link to the instance if we're not already on that page + }) }, onError: (err) => { addToast({ title: 'Error', content: err.message, variant: 'error' })