From 13da01b24658de35ebc75516dab7d320c8323bac Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Fri, 23 Sep 2022 13:56:48 -0400 Subject: [PATCH] Fixes reversed logic --- src/webviews/apps/plus/graph/GraphWrapper.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/webviews/apps/plus/graph/GraphWrapper.tsx b/src/webviews/apps/plus/graph/GraphWrapper.tsx index 93725ce..60781ce 100644 --- a/src/webviews/apps/plus/graph/GraphWrapper.tsx +++ b/src/webviews/apps/plus/graph/GraphWrapper.tsx @@ -289,8 +289,8 @@ export function GraphWrapper({ if (next) { if (rowIndex < resultIds.length - 1) { rowIndex++; - } else if (hasMoreSearchResults) { - const results = await onSearchCommitsPromise?.(search!, { more: true }); + } else if (search != null && hasMoreSearchResults) { + const results = await onSearchCommitsPromise?.(search, { more: true }); if (results?.results != null) { if (resultIds.length < results.results.ids.length) { resultIds = results.results.ids; @@ -307,8 +307,8 @@ export function GraphWrapper({ } else if (rowIndex > 0) { rowIndex--; } else { - if (hasMoreSearchResults) { - const results = await onSearchCommitsPromise?.(search!, { more: { limit: 0 } }); + if (search != null && hasMoreSearchResults) { + const results = await onSearchCommitsPromise?.(search, { more: { limit: 0 } }); if (results?.results != null) { if (resultIds.length < results.results.ids.length) { resultIds = results.results.ids; @@ -351,12 +351,12 @@ export function GraphWrapper({ const detail = e.detail; setSearch(detail); - const inValid = detail.pattern.length < 3; - if (inValid) { + const isValid = detail.pattern.length >= 3; + if (!isValid) { setSearchResultKey(undefined); setSearchResultIds(undefined); } - onSearchCommits?.(inValid ? undefined : detail); + onSearchCommits?.(isValid ? detail : undefined); }; useLayoutEffect(() => {