Skip to content

Commit a558b5e

Browse files
fix(core): disable getSources concurrent fix
The fix doesn't work when multiple sources are used.
1 parent 23e321b commit a558b5e

1 file changed

Lines changed: 20 additions & 27 deletions

File tree

packages/autocomplete-core/src/utils/getNormalizedSources.ts

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,33 @@ import {
66
InternalAutocompleteSource,
77
} from '../types';
88

9-
import { createConcurrentSafePromise } from './createConcurrentSafePromise';
109
import { noop } from './noop';
1110

12-
const runConcurrentSafePromiseForGetSources = createConcurrentSafePromise<
13-
Array<AutocompleteSource<any>>
14-
>();
15-
1611
export function getNormalizedSources<TItem>(
1712
getSources: (
1813
params: GetSourcesParams<TItem>
1914
) => MaybePromise<Array<AutocompleteSource<TItem>>>,
2015
options: GetSourcesParams<TItem>
2116
): Promise<Array<InternalAutocompleteSource<TItem>>> {
22-
return runConcurrentSafePromiseForGetSources(getSources(options)).then(
23-
(sources) => {
24-
return Promise.all(
25-
sources.filter(Boolean).map((source) => {
26-
const normalizedSource: InternalAutocompleteSource<TItem> = {
27-
getItemInputValue({ state }) {
28-
return state.query;
29-
},
30-
getItemUrl() {
31-
return undefined;
32-
},
33-
onSelect({ setIsOpen }) {
34-
setIsOpen(false);
35-
},
36-
onHighlight: noop,
37-
...source,
38-
};
17+
return Promise.resolve(getSources(options)).then((sources) => {
18+
return Promise.all(
19+
sources.filter(Boolean).map((source) => {
20+
const normalizedSource: InternalAutocompleteSource<TItem> = {
21+
getItemInputValue({ state }) {
22+
return state.query;
23+
},
24+
getItemUrl() {
25+
return undefined;
26+
},
27+
onSelect({ setIsOpen }) {
28+
setIsOpen(false);
29+
},
30+
onHighlight: noop,
31+
...source,
32+
};
3933

40-
return Promise.resolve(normalizedSource);
41-
})
42-
);
43-
}
44-
);
34+
return Promise.resolve(normalizedSource);
35+
})
36+
);
37+
});
4538
}

0 commit comments

Comments
 (0)