diff --git a/app/components/AttachEphemeralIpModal.tsx b/app/components/AttachEphemeralIpModal.tsx index fa0af0519..201cdf4e4 100644 --- a/app/components/AttachEphemeralIpModal.tsx +++ b/app/components/AttachEphemeralIpModal.tsx @@ -65,9 +65,6 @@ export const AttachEphemeralIpModal = ({ addToast(<>IP {ephemeralIp.ip} attached) onDismiss() }, - onError: (err) => { - addToast({ title: 'Error', content: err.message, variant: 'error' }) - }, }) const form = useForm({ defaultValues: { pool: defaultPool } }) @@ -96,6 +93,9 @@ export const AttachEphemeralIpModal = ({ noItemsPlaceholder="No pools available" /> + {instanceEphemeralIpAttach.error && ( +

{instanceEphemeralIpAttach.error.message}

+ )} IP {floatingIp.name} attached) onDismiss() }, - onError: (err) => { - addToast({ title: 'Error', content: err.message, variant: 'error' }) - }, }) const form = useForm({ defaultValues: { floatingIp: '' } }) const floatingIp = form.watch('floatingIp') diff --git a/app/pages/project/instances/InstancePage.tsx b/app/pages/project/instances/InstancePage.tsx index 481ed438d..9e337fa34 100644 --- a/app/pages/project/instances/InstancePage.tsx +++ b/app/pages/project/instances/InstancePage.tsx @@ -301,9 +301,6 @@ export function ResizeInstanceModal({ : undefined, // Only link to the instance if we're not already on that page }) }, - onError: (err) => { - addToast({ title: 'Error', content: err.message, variant: 'error' }) - }, }) const form = useForm({ diff --git a/test/e2e/instance.e2e.ts b/test/e2e/instance.e2e.ts index a27a7dd24..aeee65747 100644 --- a/test/e2e/instance.e2e.ts +++ b/test/e2e/instance.e2e.ts @@ -218,13 +218,10 @@ test('resize modal stays open on server error', async ({ page }) => { await resizeModal.getByRole('textbox', { name: 'Memory' }).fill('20') await resizeModal.getByRole('button', { name: 'Resize' }).click() - // Wait for the error toast, which confirms the mutation has completed - await expect(page.getByTestId('Toasts')).toContainText('Cannot update instance') - - // Modal should stay open so the user can see the error and adjust values + // Error renders inline inside the modal; modal stays open so the user can + // see the error and adjust values. + await expect(resizeModal).toContainText('Cannot update instance') await expect(resizeModal).toBeVisible() - - await closeToast(page) }) test('delete from instance detail', async ({ page }) => {