From 41495a385db5610134fcb2a776637d47bea40bbc Mon Sep 17 00:00:00 2001 From: Charles Zhao Date: Mon, 17 Jun 2024 11:12:55 +0800 Subject: [PATCH] refactor(console): improve swr error handling that previously omitted (#6021) --- packages/console/src/components/ApplicationName/index.tsx | 2 +- packages/console/src/components/UserName/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/console/src/components/ApplicationName/index.tsx b/packages/console/src/components/ApplicationName/index.tsx index 2e47e464f39..bb3d4e6c151 100644 --- a/packages/console/src/components/ApplicationName/index.tsx +++ b/packages/console/src/components/ApplicationName/index.tsx @@ -20,7 +20,7 @@ type Props = { function ApplicationName({ applicationId, isLink = false }: Props) { const isAdminConsole = applicationId === adminConsoleApplicationId; - const fetchApi = useApi({ hideErrorToast: true }); + const fetchApi = useApi({ hideErrorToast: ['entity.not_found'] }); const fetcher = useSwrFetcher(fetchApi); const { data, error } = useSWR( !isAdminConsole && `api/applications/${applicationId}`, diff --git a/packages/console/src/components/UserName/index.tsx b/packages/console/src/components/UserName/index.tsx index 0dda7496b6f..97df6142be0 100644 --- a/packages/console/src/components/UserName/index.tsx +++ b/packages/console/src/components/UserName/index.tsx @@ -23,7 +23,7 @@ type Props = { function UserName({ userId, isLink = false }: Props) { const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); - const fetchApi = useApi({ hideErrorToast: true }); + const fetchApi = useApi({ hideErrorToast: ['entity.not_found'] }); const fetcher = useSwrFetcher(fetchApi); const { data, error } = useSWR(`api/users/${userId}`, { fetcher,