Skip to content

Commit b43db1f

Browse files
authored
Revert "feat: empty table messages (#446)" (#493)
This reverts commit 58f72c4.
1 parent 58f72c4 commit b43db1f

File tree

4 files changed

+2
-35
lines changed

4 files changed

+2
-35
lines changed

CHANGELOG.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
## [3.7.6](https://github.com/eclipse-tractusx/portal-shared-components/compare/v3.7.5...v3.7.6) (2025-02-13)
3535

3636

37-
3837
### Bug Fixes
3938

4039
* upgrade storybook to version 8.5.3 ([4f4df10](https://github.com/eclipse-tractusx/portal-shared-components/commit/4f4df107bf6ca02ca959660c121f4dc18ac7b10a))
@@ -44,9 +43,6 @@
4443
* upgrade storybook to version 8.5.3 ([6cccaec](https://github.com/eclipse-tractusx/portal-shared-components/commit/6cccaec07fd20259fc9568ffc1e4a430203200e9))
4544

4645
## [3.7.5](https://github.com/eclipse-tractusx/portal-shared-components/compare/v3.7.4...v3.7.5) (2025-01-20)
47-
- **Table Empty Text** [4.0.3]
48-
- fixed empty table messages with consistency [#446](https://github.com/eclipse-tractusx/portal-shared-components/pull/446)
49-
5046

5147

5248
### Bug Fixes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@catena-x/portal-shared-components",
3-
"version": "4.0.3",
3+
"version": "4.0.2",
44
"description": "Eclipse Tractus-X Portal Shared Components",
55
"author": "Eclipse Tractus-X Contributors",
66
"license": "Apache-2.0",

src/components/basic/Table/PageLoadingTable.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ export interface PageLoadingTableProps<Row, Args>
5353
allItems?: Row[]
5454
callbackToPage?: (data: PaginResult<Row>) => void
5555
allItemsLoadedHint?: string
56-
emptyDataMsg?: string
57-
noSearchResultsMsg?: string
5856
}
5957

6058
const scrollOffset = 350 // Adjust this value for earlier load
@@ -67,8 +65,6 @@ export const PageLoadingTable = function <Row, Args>({
6765
allItems,
6866
callbackToPage,
6967
allItemsLoadedHint = 'All items have been loaded.',
70-
emptyDataMsg = 'No data found',
71-
noSearchResultsMsg = 'No search results found',
7268
...props
7369
}: PageLoadingTableProps<Row, Args>) {
7470
const [page, setPage] = useState(0)
@@ -83,14 +79,12 @@ export const PageLoadingTable = function <Row, Args>({
8379
},
8480
})
8581
const [loading, setLoading] = useState(true)
86-
const [noRowsMsg, setNoRowsMsg] = useState('')
8782

8883
function nextPage() {
8984
setPage(page + 1)
9085
}
9186
const hasMore = data ? hasMorePages(data) : false
9287
const maxRows = data ? getMaxRows(data) : 0
93-
const { searchExpr } = props
9488

9589
useEffect(() => {
9690
if (!allItems) {
@@ -136,16 +130,6 @@ export const PageLoadingTable = function <Row, Args>({
136130
}
137131
}, [isSuccess, isFetching, data, clear, loaded])
138132

139-
useEffect(() => {
140-
if (data) {
141-
if (!searchExpr && data.content.length === 0) {
142-
setNoRowsMsg(emptyDataMsg)
143-
} else if (searchExpr && data.content.length === 0) {
144-
setNoRowsMsg(noSearchResultsMsg)
145-
}
146-
}
147-
}, [data, searchExpr])
148-
149133
const handleScroll = useCallback(() => {
150134
const scrollableElement = document.documentElement
151135
if (
@@ -175,7 +159,6 @@ export const PageLoadingTable = function <Row, Args>({
175159
error={error}
176160
rows={items}
177161
reload={refetch}
178-
noRowsMsg={noRowsMsg}
179162
{...props}
180163
/>
181164
{/* Display loading spinner while fetching data */}

src/components/basic/Table/index.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -195,19 +195,7 @@ export const Table = ({
195195

196196
const renderErrorMessage = () => {
197197
if (rowsCount === 0 || error == null) {
198-
if (noRowsMsg && noRowsMsg.includes('\n')) {
199-
const messageParts = noRowsMsg.split(/[\n|]/)
200-
return (
201-
<Stack spacing={1} alignItems="center">
202-
{messageParts.map((part, index) => (
203-
<Typography key={index} variant="body2" align="center">
204-
{part.trim()}
205-
</Typography>
206-
))}
207-
</Stack>
208-
)
209-
}
210-
return <></>
198+
return <Typography variant="body2">{noRowsMsg ?? 'No rows'}</Typography>
211199
}
212200
if (error.status >= 400 && error.status < 500) {
213201
return <Error400Overlay errorMessage4xx={error.message} />

0 commit comments

Comments
 (0)