Skip to content

Commit a1fb241

Browse files
committed
Do not attempt prefix validation with broken BGP API
1 parent 4df638c commit a1fb241

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/hooks/useSearch.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ export default function useSearch(
195195
const search = async () => {
196196
const searchResult: Search = await retrieve();
197197

198+
const bgpApiError = searchResult.type == 'empty-match';
199+
198200
if (searchResult.error_msg) {
199201
return setError(searchResult.error_msg);
200202
}
@@ -209,7 +211,7 @@ export default function useSearch(
209211
let nextAsns = arrayFromCommaSeperated(params.asns);
210212

211213
// fill in the asn provided in the search result
212-
if (validatePrefix) {
214+
if (validatePrefix && !bgpApiError) {
213215
const resultAsns = searchResult.result.meta
214216
.map((m) => (m.originASNs ? m.originASNs : null))
215217
.find((asns) => asns);

0 commit comments

Comments
 (0)