Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert: Add back in early return for onSearch/debounce #1102

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions src/components/Filters/MultiFilter.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,3 @@ export function LazyLoading() {
})("key");
return filter.render([loadTestOptions[2].id, loadTestOptions[4].id], () => {}, {}, true, false);
}

export function OnSearch() {
const [_, setProjectSearch] = useState<string>();
const testOptions: HasIdAndName[] = zeroTo(10).map((i) => ({ id: String(i), name: `Project ${i}` }));

const filter = multiFilter({
options: testOptions,
getOptionValue: (s) => s.id,
getOptionLabel: (s) => s.name,
onSearch: (search) => setProjectSearch(search),
})("key");
return filter.render(undefined, () => {}, {}, true, false);
}
34 changes: 0 additions & 34 deletions src/components/Filters/MultiFilter.test.tsx

This file was deleted.

7 changes: 0 additions & 7 deletions src/components/Filters/testDomain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,6 @@ export const stageFilterDisabledOptions: StageFilter = multiFilter({
disabledOptions: [{ value: Stage.StageOne, reason: "I have a reason to be disabled." }, Stage.StageTwo],
});

export const stageOnSearch: StageFilter = multiFilter({
options: stageOptions,
getOptionValue: (s) => s.code,
getOptionLabel: (s) => s.name,
onSearch: () => {},
});

export const stageSingleFilter: StageSingleFilter = singleFilter({
options: stageOptions,
getOptionValue: (s) => s.code,
Expand Down
13 changes: 1 addition & 12 deletions src/inputs/internal/ComboBoxBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,6 @@ export function ComboBoxBase<O, V extends Value>(props: ComboBoxBaseProps<O, V>)

// Reset inputValue when closed or selected changes
useEffect(() => {
// if we are using the onSearch functionality with debounceSearch, we don't want to reset the input value
if (onSearch && debouncedSearch) return;
if (state.isOpen && multiselect) {
// While the multiselect is open, let the user keep typing
setFieldState((prevState) => ({
Expand All @@ -322,16 +320,7 @@ export function ComboBoxBase<O, V extends Value>(props: ComboBoxBaseProps<O, V>)
inputValue: getInputValue(selectedOptions, getOptionLabel, multiselect, nothingSelectedText, isReadOnly),
}));
}
}, [
state.isOpen,
selectedOptions,
getOptionLabel,
multiselect,
nothingSelectedText,
isReadOnly,
onSearch,
debouncedSearch,
]);
}, [state.isOpen, selectedOptions, getOptionLabel, multiselect, nothingSelectedText, isReadOnly]);

// Call on search callback when the user types in the input field
useEffect(() => {
Expand Down
Loading