From 374aa82e22e91f837ba492b4496a95d19ffbc375 Mon Sep 17 00:00:00 2001 From: SergeantPanda Date: Mon, 7 Jul 2025 17:08:53 -0500 Subject: [PATCH] Refactor editChannel to use selectedTableIds directly from the table state and remove unused selection clearing effects. --- frontend/src/components/tables/ChannelsTable.jsx | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/frontend/src/components/tables/ChannelsTable.jsx b/frontend/src/components/tables/ChannelsTable.jsx index 8c19671a..7a9d5007 100644 --- a/frontend/src/components/tables/ChannelsTable.jsx +++ b/frontend/src/components/tables/ChannelsTable.jsx @@ -376,7 +376,7 @@ const ChannelsTable = ({ }) => { const editChannel = async (ch = null) => { // Use table's selected state instead of store state to avoid stale selections - const currentSelection = table ? table.getState().selectedTableIds : []; + const currentSelection = table ? table.selectedTableIds : []; console.log('editChannel called with:', { ch, currentSelection, tableExists: !!table }); if (currentSelection.length > 1) { @@ -634,18 +634,6 @@ const ChannelsTable = ({ }) => { setPaginationString(`${startItem} to ${endItem} of ${totalCount}`); }, [pagination.pageIndex, pagination.pageSize, totalCount]); - // Clear selection when data changes (e.g., when navigating back to the page) - useEffect(() => { - setSelectedChannelIds([]); - }, [data, setSelectedChannelIds]); - - // Clear selection when component unmounts - useEffect(() => { - return () => { - setSelectedChannelIds([]); - }; - }, [setSelectedChannelIds]); - const columns = useMemo( () => [ {