Skip to content

Commit

Permalink
[docs] Fix async example + add QA-able dev output
Browse files Browse the repository at this point in the history
- I can't think of a generic production scenario where someone would do something based on `hasMatchingOptions`, so I'll just log it for info
  • Loading branch information
cee-chen committed Nov 1, 2023
1 parent d92d05e commit ebc0a96
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src-docs/src/views/combo_box/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ export default () => {
setSelected(selectedOptions);
};

const onSearchChange = useCallback((searchValue) => {
const onSearchChange = useCallback((searchValue, hasMatchingOptions) => {
console.info({ searchValue, hasMatchingOptions });

setLoading(true);
setOptions([]);

Expand Down Expand Up @@ -79,7 +81,7 @@ export default () => {
// Create the option if it doesn't exist.
if (
flattenedOptions.findIndex(
(option) => option.value.trim().toLowerCase() === normalizedSearchValue
(option) => option.label.trim().toLowerCase() === normalizedSearchValue
) === -1
) {
// Simulate creating this option on the server.
Expand Down

0 comments on commit ebc0a96

Please sign in to comment.