From ed6e8f31ee69b756df0b9ecf64160bdc638ff6d3 Mon Sep 17 00:00:00 2001 From: Firman Ramdhani <33869609+firmanramdhani@users.noreply.github.com> Date: Thu, 16 Jul 2026 10:51:06 +0700 Subject: [PATCH] fix: update BreadcrumbBar component to correctly assign keys and enhance error handling in EnterpriseDetailPageProvider --- .../components/module-page-header.tsx | 7 ++++--- .../providers/detail-page.provider.tsx | 17 ++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/ui/src/foundations/enterprise-module/components/module-page-header.tsx b/packages/ui/src/foundations/enterprise-module/components/module-page-header.tsx index 4cb2098..3760682 100644 --- a/packages/ui/src/foundations/enterprise-module/components/module-page-header.tsx +++ b/packages/ui/src/foundations/enterprise-module/components/module-page-header.tsx @@ -80,7 +80,6 @@ function BreadcrumbBar({ breadcrumbs }: BreadcrumbBarProps) { const isText = item.type === 'text'; const isLast = index === breadcrumbs.length - 1; const sharedProps = { - key: index, c: !isLast ? ('dimmed' as const) : undefined, size: 'xs' as const, fw: 500, @@ -92,11 +91,13 @@ function BreadcrumbBar({ breadcrumbs }: BreadcrumbBarProps) { }; return !isText ? ( - + {item.label} ) : ( - {item.label} + + {item.label} + ); })} diff --git a/packages/ui/src/foundations/enterprise-module/providers/detail-page.provider.tsx b/packages/ui/src/foundations/enterprise-module/providers/detail-page.provider.tsx index 2588c43..61634a2 100644 --- a/packages/ui/src/foundations/enterprise-module/providers/detail-page.provider.tsx +++ b/packages/ui/src/foundations/enterprise-module/providers/detail-page.provider.tsx @@ -79,13 +79,12 @@ export function EnterpriseDetailPageProvider( setDetailData(data as E); if (onDetailLoaded) onDetailLoaded(data as E); } - } catch (error) { - // FIXME => remove this example later; - - const data = { id: 1, code: 'ABCD-0001', status: 'open' } as any; - setDetailData(data as E); - if (onDetailLoaded) onDetailLoaded(data as E); - console.error('Failed to load detail data', error); + } catch (error: any) { + notifications.show({ + title: t('common:notifications.errorTitle'), + message: error?.message, + color: 'red', + }); } finally { setIsLoading(false); } @@ -202,7 +201,7 @@ export function EnterpriseDetailPageProvider( : currentConfig?.successMessage; notifications.show({ - title: t('common:notifications.successTitle', { defaultValue: 'Success' }), + title: t('common:notifications.successTitle'), message: customSuccessMessage || defaultSuccessMessage, color: 'teal', }); @@ -227,7 +226,7 @@ export function EnterpriseDetailPageProvider( : currentConfig?.errorMessage; notifications.show({ - title: t('common:notifications.errorTitle', { defaultValue: 'Error' }), + title: t('common:notifications.errorTitle'), message: customErrorMessage || defaultErrorMessage, color: 'red', });