Refactor editChannel to use selectedTableIds directly from the table state and remove unused selection clearing effects.

This commit is contained in:
SergeantPanda 2025-07-07 17:08:53 -05:00
parent 01d4b25303
commit 374aa82e22

View file

@ -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(
() => [
{