unify toggling (#3378)

This commit is contained in:
pablonyx 2024-12-09 11:48:06 -08:00 committed by GitHub
parent 970320bd49
commit 0746e0be5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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>
@ -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;