Skip to content

Commit f732450

Browse files
committed
fix: remove TABLE_ID_MAP, add reload to ErrorScreenManager & more
1 parent 4d63e96 commit f732450

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

src/Shared/Components/Table/InternalTable.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const InternalTable = ({
102102
[visibleColumns],
103103
)
104104

105-
const [areFilteredRowsLoading, filteredRows, filteredRowsError] = useAsync(async () => {
105+
const [areFilteredRowsLoading, filteredRows, filteredRowsError, reloadFilteredRows] = useAsync(async () => {
106106
if (!rows && !getRows) {
107107
throw new Error('Neither rows nor getRows function provided')
108108
}
@@ -117,7 +117,7 @@ const InternalTable = ({
117117
}
118118
: () => getRows(filterData),
119119
})
120-
}, [searchKey, sortBy, sortOrder, rows, sortByToColumnIndexMap, ...Object.values(otherFilters)])
120+
}, [searchKey, sortBy, sortOrder, rows, sortByToColumnIndexMap, JSON.stringify(otherFilters)])
121121

122122
const bulkSelectionCount = getSelectedIdentifiersCount?.() ?? 0
123123

@@ -192,8 +192,9 @@ const InternalTable = ({
192192
gridTemplateColumns,
193193
}}
194194
>
195-
{visibleColumns.map(({ horizontallySticky }) => (
195+
{visibleColumns.map(({ horizontallySticky, label }) => (
196196
<div
197+
key={label}
197198
className={`${horizontallySticky ? 'dc__position-sticky dc__left-0 dc__zi-1' : ''} pr-12 py-12 flex`}
198199
aria-label="Loading..."
199200
>
@@ -289,7 +290,7 @@ const InternalTable = ({
289290
}
290291

291292
if (filteredRowsError && !areFilteredRowsLoading) {
292-
return <ErrorScreenManager code={filteredRowsError.code} />
293+
return <ErrorScreenManager code={filteredRowsError.code} reload={reloadFilteredRows} />
293294
}
294295

295296
return (

src/Shared/Components/Table/constants.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,4 @@ export const EVENT_TARGET = new EventTarget()
1010

1111
export const DRAG_SELECTOR_IDENTIFIER = 'table-drag-selector'
1212

13-
export const TABLE_ID_MAP = {
14-
STORYBOOK: 'storybook-table',
15-
} as const
16-
1713
export const SHIMMER_DUMMY_ARRAY = [1, 2, 3]

src/Shared/Components/Table/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ export type {
66
TableProps,
77
CellComponentProps as TableCellComponentProps,
88
} from './types'
9-
export { TABLE_ID_MAP } from './constants'

src/Shared/Components/Table/types.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { SortableTableHeaderCellProps, useResizableTableConfig } from '@Common/S
33
import { UseStateFiltersProps, UseStateFiltersReturnType, UseUrlFiltersProps } from '@Common/Hooks'
44
import { GenericEmptyStateType } from '@Common/index'
55
import { GenericFilterEmptyStateProps } from '@Common/EmptyState/types'
6-
import { TABLE_ID_MAP } from './constants'
76
import { useBulkSelection, UseBulkSelectionProps } from '../BulkSelection'
87

98
export interface UseFiltersReturnType extends UseStateFiltersReturnType<string> {}
@@ -147,7 +146,7 @@ export type ViewWrapperProps = PropsWithChildren<
147146
>
148147

149148
export type InternalTableProps = Required<Pick<ConfigurableColumnsType, 'visibleColumns' | 'setVisibleColumns'>> & {
150-
id: (typeof TABLE_ID_MAP)[keyof typeof TABLE_ID_MAP]
149+
id: `table__${string}`
151150

152151
loading?: boolean
153152

0 commit comments

Comments
 (0)