unify toggling (#3378)

This commit is contained in:
pablonyx
2024-12-09 11:48:06 -08:00
committed by GitHub
parent 970320bd49
commit 0746e0be5b

View File

@ -353,13 +353,9 @@ export function CCPairIndexingStatusTable({
); );
}; };
const toggleSources = () => { const toggleSources = () => {
const currentToggledCount =
Object.values(connectorsToggled).filter(Boolean).length;
const shouldToggleOn = currentToggledCount < sortedSources.length / 2;
const connectors = sortedSources.reduce( const connectors = sortedSources.reduce(
(acc, source) => { (acc, source) => {
acc[source] = shouldToggleOn; acc[source] = shouldExpand;
return acc; return acc;
}, },
{} as Record<ValidSources, boolean> {} as Record<ValidSources, boolean>
@ -368,6 +364,7 @@ export function CCPairIndexingStatusTable({
setConnectorsToggled(connectors); setConnectorsToggled(connectors);
Cookies.set(TOGGLED_CONNECTORS_COOKIE_NAME, JSON.stringify(connectors)); Cookies.set(TOGGLED_CONNECTORS_COOKIE_NAME, JSON.stringify(connectors));
}; };
const shouldExpand = const shouldExpand =
Object.values(connectorsToggled).filter(Boolean).length < Object.values(connectorsToggled).filter(Boolean).length <
sortedSources.length; sortedSources.length;