Skip to content

Commit

Permalink
Add TODO comments for Table component introduced by search
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnadeluy committed Feb 28, 2024
1 parent 5d41507 commit 12bd39c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,17 @@ const Table = ({ title, dropdownAriaLabel, dropdownFilterItems, columns, data }:

const isOnMobile = useMediaQuery({ query: 'screen and (max-width: 767px)' }) // $mobile variable from ssb-component-library

/* TODO:
* Fix bug; reinitializes 'data' state(?) a few seconds after Tab onClick.
So once after Tab onClick, and twice a few seconds later
Order after Tab onClick: 1. Sets state to current tab table data. 2. Then to previous tab table data. 3. Then back to current tab table data.
* Notes:
- data is a stored in a state that is set by useEffect and an API call on a higher hierarchical level (e.g. TeamOverview)
- No indication of states reinitializing during the view jittering in React Component Developer tools
*/
useEffect(() => {
if (searchFilterKeyword !== '') {
if (searchFilterKeyword !== '' && data.length) {
const filterTableData = data.filter((row) =>
Object.values(row).toString().toLowerCase().includes(searchFilterKeyword.toLowerCase())
)
Expand Down

0 comments on commit 12bd39c

Please sign in to comment.