Fix page selector custom values

This commit is contained in:
Aditya committed 2026-08-26 18:22:15 +05:30
1 parent eea124bbf8
commit de7c06c0a5
2 files changed
+9 -6

No files matched your search

@@ -65,7 +65,7 @@ test('clears the selected website value when the input is cleared', () => {
expect(onChange).toHaveBeenCalledWith('');
});
test('combines values from both Journey step types', () => {
test('combines values from both Journey step types with the typed value', () => {
render(
<WebsiteValueComboBox
label="Start step"
@@ -74,11 +74,12 @@ test('combines values from both Journey step types', () => {
additionalType="event"
startDate={new Date('2026-08-01')}
endDate={new Date('2026-08-03')}
value=""
value="/"
onChange={() => {}}
/>,
);
expect(screen.getByText('/')).toBeInTheDocument();
expect(screen.getByText('/home')).toBeInTheDocument();
expect(screen.getByText('signup')).toBeInTheDocument();
});
@@ -56,12 +56,14 @@ export function WebsiteValueComboBox({
}, [type, additionalType]);
const items = useMemo(() => {
const values = [...(primaryQuery.data || []), ...(additionalQuery.data || [])]
.map(({ value }) => value)
.filter(Boolean);
const values = [
value,
...(primaryQuery.data || []).map(({ value }) => value),
...(additionalQuery.data || []).map(({ value }) => value),
].filter(Boolean);
return [...new Set<string>(values)];
}, [primaryQuery.data, additionalQuery.data]);
}, [value, primaryQuery.data, additionalQuery.data]);
return (
<div className={cn('flex flex-col gap-1', className)}>