mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-26 08:35:00 +00:00
[wip] Enhance AddressPicker to auto-select position when a single address with one position is found.
This commit is contained in:
@@ -63,6 +63,11 @@ const performSearchForAddress = async (search: string): Promise<void> => {
|
|||||||
abortControllerSearchAddress,
|
abortControllerSearchAddress,
|
||||||
);
|
);
|
||||||
abortControllerSearchAddress = null;
|
abortControllerSearchAddress = null;
|
||||||
|
|
||||||
|
// check if there is only one result
|
||||||
|
if (addresses.value.length === 1 && Object.keys(addresses.value[0].positions).length === 1) {
|
||||||
|
onPickPosition(Object.keys(addresses.value[0].positions)[0]);
|
||||||
|
}
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
if (e instanceof DOMException && e.name === "AbortError") {
|
if (e instanceof DOMException && e.name === "AbortError") {
|
||||||
console.log("search aborted for:", search);
|
console.log("search aborted for:", search);
|
||||||
|
Reference in New Issue
Block a user