Skip to content

Commit

Permalink
unify toggling
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Dec 9, 2024
1 parent 970320b commit 9c5e986
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,13 +353,9 @@ export function CCPairIndexingStatusTable({
);
};
const toggleSources = () => {
const currentToggledCount =
Object.values(connectorsToggled).filter(Boolean).length;
const shouldToggleOn = currentToggledCount < sortedSources.length / 2;

const connectors = sortedSources.reduce(
(acc, source) => {
acc[source] = shouldToggleOn;
acc[source] = shouldExpand;
return acc;
},
{} as Record<ValidSources, boolean>
Expand All @@ -368,6 +364,7 @@ export function CCPairIndexingStatusTable({
setConnectorsToggled(connectors);
Cookies.set(TOGGLED_CONNECTORS_COOKIE_NAME, JSON.stringify(connectors));
};

const shouldExpand =
Object.values(connectorsToggled).filter(Boolean).length <
sortedSources.length;
Expand Down

0 comments on commit 9c5e986

Please sign in to comment.