fixed removal logic of epg store

This commit is contained in:
dekzter 2025-03-26 13:35:41 -04:00
parent de5063d20b
commit 323cc7b52c
2 changed files with 9 additions and 5 deletions

View file

@ -24,6 +24,7 @@ const EPGsTable = () => {
const [rowSelection, setRowSelection] = useState([]);
const { epgs } = useEPGsStore();
console.log(epgs);
const theme = useMantineTheme();

View file

@ -49,11 +49,14 @@ const useEPGsStore = create((set) => ({
})),
removeEPGs: (epgIds) =>
set((state) => ({
epgs: Object.fromEntries(
Object.entries(state.epgs).filter(([id]) => !epgIds.includes(id))
),
})),
set((state) => {
const updatedEPGs = { ...state.epgs };
for (const id of epgIds) {
delete updatedEPGs[id];
}
return { epgs: updatedEPGs };
}),
}));
export default useEPGsStore;