diff --git a/frontend/beCompliant/src/components/Table.tsx b/frontend/beCompliant/src/components/Table.tsx index 8e071cc4..6a407d4d 100644 --- a/frontend/beCompliant/src/components/Table.tsx +++ b/frontend/beCompliant/src/components/Table.tsx @@ -52,14 +52,16 @@ export function TableComponent({ ] = useColumnVisibility(); const initialSorting: SortingState = JSON.parse( - localStorage.getItem('sortingState') || '[]' + localStorage.getItem(`sortingState_${tableData.id}`) || '[]' ); - const [sorting, setSorting] = useState(initialSorting); useEffect(() => { - localStorage.setItem('sortingState', JSON.stringify(sorting)); - }, [sorting]); + localStorage.setItem( + `sortingState_${tableData.id}`, + JSON.stringify(sorting) + ); + }, [sorting, tableData.id]); const columns: ColumnDef[] = tableData.columns.map( (field, index) => ({