fix(onboarding): preserve selected integrations when navigating back

The multi-select grid initializes its own internal Set on mount, so
returning from the configure phase to the select phase lost all
selections. Accept an initialSelection prop and pass the parent's
selectedKinds to restore state on re-mount.
This commit is contained in:
Thomas Camlong committed 2026-05-14 18:06:41 +02:00
1 parent 904bef50d8
commit c7300aee76
2 files changed
+4 -2

No files matched your search

@@ -102,7 +102,7 @@ export const InitIntegrations = () => {
<Stack>
<Text>{t("description")}</Text>
<IntegrationMultiSelectGrid onSelectionChange={handleSelectionChange} />
<IntegrationMultiSelectGrid onSelectionChange={handleSelectionChange} initialSelection={selectedKinds} />
<Group justify="space-between">
<Button variant="subtle" onClick={() => void finishSetupAsync()}>
@@ -17,15 +17,17 @@ import {
interface IntegrationMultiSelectGridProps {
onSelectionChange: (kinds: IntegrationKind[]) => void;
initialSelection?: IntegrationKind[];
enableMockIntegration?: boolean;
}
export const IntegrationMultiSelectGrid = ({
onSelectionChange,
initialSelection = [],
enableMockIntegration = false,
}: IntegrationMultiSelectGridProps) => {
const [search, setSearch] = useState("");
const [selectedKinds, setSelectedKinds] = useState<Set<IntegrationKind>>(new Set());
const [selectedKinds, setSelectedKinds] = useState<Set<IntegrationKind>>(() => new Set(initialSelection));
const t = useI18n();
const toggleKind = useCallback(