From ebc0a96c86d959d3213841edf635a48143eb3d3c Mon Sep 17 00:00:00 2001 From: Cee Chen Date: Wed, 1 Nov 2023 14:20:43 -0700 Subject: [PATCH] [docs] Fix async example + add QA-able dev output - 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 --- src-docs/src/views/combo_box/async.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src-docs/src/views/combo_box/async.js b/src-docs/src/views/combo_box/async.js index caddfee823ae..a0f1887e1c79 100644 --- a/src-docs/src/views/combo_box/async.js +++ b/src-docs/src/views/combo_box/async.js @@ -47,7 +47,9 @@ export default () => { setSelected(selectedOptions); }; - const onSearchChange = useCallback((searchValue) => { + const onSearchChange = useCallback((searchValue, hasMatchingOptions) => { + console.info({ searchValue, hasMatchingOptions }); + setLoading(true); setOptions([]); @@ -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.