From 3ae3017fd9610695d6a142d4d54d52eb55360f41 Mon Sep 17 00:00:00 2001 From: Saad Bin Rafiq <149799297+saadanzari@users.noreply.github.com> Date: Wed, 12 Nov 2025 09:42:48 +0100 Subject: [PATCH] Revert "feat: empty table messages (#446)" This reverts commit 58f72c4daf25c1d4cd097e633c14ba05177bb6f1. --- CHANGELOG.md | 4 ---- package.json | 2 +- src/components/basic/Table/PageLoadingTable.tsx | 17 ----------------- src/components/basic/Table/index.tsx | 14 +------------- 4 files changed, 2 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dd62cdb..bc47ee9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,7 +34,6 @@ ## [3.7.6](https://github.com/eclipse-tractusx/portal-shared-components/compare/v3.7.5...v3.7.6) (2025-02-13) - ### Bug Fixes * upgrade storybook to version 8.5.3 ([4f4df10](https://github.com/eclipse-tractusx/portal-shared-components/commit/4f4df107bf6ca02ca959660c121f4dc18ac7b10a)) @@ -44,9 +43,6 @@ * upgrade storybook to version 8.5.3 ([6cccaec](https://github.com/eclipse-tractusx/portal-shared-components/commit/6cccaec07fd20259fc9568ffc1e4a430203200e9)) ## [3.7.5](https://github.com/eclipse-tractusx/portal-shared-components/compare/v3.7.4...v3.7.5) (2025-01-20) -- **Table Empty Text** [4.0.3] - - fixed empty table messages with consistency [#446](https://github.com/eclipse-tractusx/portal-shared-components/pull/446) - ### Bug Fixes diff --git a/package.json b/package.json index 7ed5c643..a1a6b036 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@catena-x/portal-shared-components", - "version": "4.0.3", + "version": "4.0.2", "description": "Eclipse Tractus-X Portal Shared Components", "author": "Eclipse Tractus-X Contributors", "license": "Apache-2.0", diff --git a/src/components/basic/Table/PageLoadingTable.tsx b/src/components/basic/Table/PageLoadingTable.tsx index a7d69c3d..8dac8310 100644 --- a/src/components/basic/Table/PageLoadingTable.tsx +++ b/src/components/basic/Table/PageLoadingTable.tsx @@ -53,8 +53,6 @@ export interface PageLoadingTableProps allItems?: Row[] callbackToPage?: (data: PaginResult) => void allItemsLoadedHint?: string - emptyDataMsg?: string - noSearchResultsMsg?: string } const scrollOffset = 350 // Adjust this value for earlier load @@ -67,8 +65,6 @@ export const PageLoadingTable = function ({ allItems, callbackToPage, allItemsLoadedHint = 'All items have been loaded.', - emptyDataMsg = 'No data found', - noSearchResultsMsg = 'No search results found', ...props }: PageLoadingTableProps) { const [page, setPage] = useState(0) @@ -83,14 +79,12 @@ export const PageLoadingTable = function ({ }, }) const [loading, setLoading] = useState(true) - const [noRowsMsg, setNoRowsMsg] = useState('') function nextPage() { setPage(page + 1) } const hasMore = data ? hasMorePages(data) : false const maxRows = data ? getMaxRows(data) : 0 - const { searchExpr } = props useEffect(() => { if (!allItems) { @@ -136,16 +130,6 @@ export const PageLoadingTable = function ({ } }, [isSuccess, isFetching, data, clear, loaded]) - useEffect(() => { - if (data) { - if (!searchExpr && data.content.length === 0) { - setNoRowsMsg(emptyDataMsg) - } else if (searchExpr && data.content.length === 0) { - setNoRowsMsg(noSearchResultsMsg) - } - } - }, [data, searchExpr]) - const handleScroll = useCallback(() => { const scrollableElement = document.documentElement if ( @@ -175,7 +159,6 @@ export const PageLoadingTable = function ({ error={error} rows={items} reload={refetch} - noRowsMsg={noRowsMsg} {...props} /> {/* Display loading spinner while fetching data */} diff --git a/src/components/basic/Table/index.tsx b/src/components/basic/Table/index.tsx index b8aebfd6..0f22ebd8 100644 --- a/src/components/basic/Table/index.tsx +++ b/src/components/basic/Table/index.tsx @@ -195,19 +195,7 @@ export const Table = ({ const renderErrorMessage = () => { if (rowsCount === 0 || error == null) { - if (noRowsMsg && noRowsMsg.includes('\n')) { - const messageParts = noRowsMsg.split(/[\n|]/) - return ( - - {messageParts.map((part, index) => ( - - {part.trim()} - - ))} - - ) - } - return <> + return {noRowsMsg ?? 'No rows'} } if (error.status >= 400 && error.status < 500) { return