This commit is contained in:
bkellam 2025-11-21 15:26:04 -08:00
parent 7c964d9c28
commit ac19251cb5
3 changed files with 16 additions and 14 deletions

View file

@ -56,7 +56,7 @@ export const SearchResultsPanel = forwardRef<SearchResultsPanelHandle, SearchRes
scrollOffset: restoreOffset, scrollOffset: restoreOffset,
measurementsCache: restoreMeasurementsCache, measurementsCache: restoreMeasurementsCache,
showAllMatchesMap: restoreShowAllMatchesStates, showAllMatchesMap: restoreShowAllMatchesStates,
} = history.state as ScrollHistoryState; } = (history.state ?? {}) as ScrollHistoryState;
const [showAllMatchesMap, showAllMatchesActions] = useMap<string, boolean>(restoreShowAllMatchesStates || []); const [showAllMatchesMap, showAllMatchesActions] = useMap<string, boolean>(restoreShowAllMatchesStates || []);

View file

@ -42,8 +42,6 @@ export const search = (request: SearchRequest) => sew(() =>
repoSearchScope, repoSearchScope,
}); });
logger.debug(`zoektSearchRequest:\n${JSON.stringify(zoektSearchRequest, null, 2)}`);
return zoektSearch(zoektSearchRequest, prisma); return zoektSearch(zoektSearchRequest, prisma);
})); }));
@ -64,8 +62,6 @@ export const streamSearch = (request: SearchRequest) => sew(() =>
repoSearchScope, repoSearchScope,
}); });
logger.debug(`zoektStreamSearchRequest:\n${JSON.stringify(zoektSearchRequest, null, 2)}`);
return zoektStreamSearch(zoektSearchRequest, prisma); return zoektStreamSearch(zoektSearchRequest, prisma);
})); }));

View file

@ -120,12 +120,14 @@ export const zoektSearch = async (searchRequest: ZoektGrpcSearchRequest, prisma:
const metadata = new grpc.Metadata(); const metadata = new grpc.Metadata();
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
client.Search(searchRequest, metadata, async (error, response) => { client.Search(searchRequest, metadata, (error, response) => {
if (error || !response) { if (error || !response) {
reject(error || new Error('No response received')); reject(error || new Error('No response received'));
return; return;
} }
(async () => {
try {
const reposMapCache = await createReposMapForChunk(response, new Map<string | number, Repo>(), prisma); const reposMapCache = await createReposMapForChunk(response, new Map<string | number, Repo>(), prisma);
const { stats, files, repositoryInfo } = await transformZoektSearchResponse(response, reposMapCache); const { stats, files, repositoryInfo } = await transformZoektSearchResponse(response, reposMapCache);
@ -133,8 +135,12 @@ export const zoektSearch = async (searchRequest: ZoektGrpcSearchRequest, prisma:
stats, stats,
files, files,
repositoryInfo, repositoryInfo,
isSearchExhaustive: stats.actualMatchCount <= stats.totalMatchCount, isSearchExhaustive: stats.totalMatchCount <= stats.actualMatchCount,
} satisfies SearchResponse); } satisfies SearchResponse);
} catch (err) {
reject(err);
}
})();
}); });
}); });
} }