MCPcopy Index your code
hub / github.com/adobe/react-spectrum / load

Function load

packages/react-aria-components/test/Autocomplete.test.tsx:338–361  ·  view source on GitHub ↗
({filterText})

Source from the content-addressed store, hash-verified

336}) => {
337 let list = useAsyncList<AutocompleteItem>({
338 async load({filterText}) {
339 let json = (await new Promise(resolve => {
340 setTimeout(() => {
341 resolve(
342 filterText
343 ? items.filter(item => {
344 let name = item.name.toLowerCase();
345 for (let filterChar of filterText.toLowerCase()) {
346 if (!name.includes(filterChar)) {
347 return false;
348 }
349 name = name.replace(filterChar, '');
350 }
351 return true;
352 })
353 : items
354 );
355 }, 300);
356 })) as AutocompleteItem[];
357
358 return {
359 items: json
360 };
361 }
362 });
363
364 return (

Callers

nothing calls this directly

Calls 2

filterMethod · 0.65
resolveFunction · 0.50

Tested by

no test coverage detected