Skip to content

Commit ac19251

Browse files
feedback
1 parent 7c964d9 commit ac19251

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

packages/web/src/app/[domain]/search/components/searchResultsPanel/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const SearchResultsPanel = forwardRef<SearchResultsPanelHandle, SearchRes
5656
scrollOffset: restoreOffset,
5757
measurementsCache: restoreMeasurementsCache,
5858
showAllMatchesMap: restoreShowAllMatchesStates,
59-
} = history.state as ScrollHistoryState;
59+
} = (history.state ?? {}) as ScrollHistoryState;
6060

6161
const [showAllMatchesMap, showAllMatchesActions] = useMap<string, boolean>(restoreShowAllMatchesStates || []);
6262

packages/web/src/features/search/searchApi.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ export const search = (request: SearchRequest) => sew(() =>
4242
repoSearchScope,
4343
});
4444

45-
logger.debug(`zoektSearchRequest:\n${JSON.stringify(zoektSearchRequest, null, 2)}`);
46-
4745
return zoektSearch(zoektSearchRequest, prisma);
4846
}));
4947

@@ -64,8 +62,6 @@ export const streamSearch = (request: SearchRequest) => sew(() =>
6462
repoSearchScope,
6563
});
6664

67-
logger.debug(`zoektStreamSearchRequest:\n${JSON.stringify(zoektSearchRequest, null, 2)}`);
68-
6965
return zoektStreamSearch(zoektSearchRequest, prisma);
7066
}));
7167

packages/web/src/features/search/zoektSearcher.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,27 @@ export const zoektSearch = async (searchRequest: ZoektGrpcSearchRequest, prisma:
120120
const metadata = new grpc.Metadata();
121121

122122
return new Promise((resolve, reject) => {
123-
client.Search(searchRequest, metadata, async (error, response) => {
123+
client.Search(searchRequest, metadata, (error, response) => {
124124
if (error || !response) {
125125
reject(error || new Error('No response received'));
126126
return;
127127
}
128128

129-
const reposMapCache = await createReposMapForChunk(response, new Map<string | number, Repo>(), prisma);
130-
const { stats, files, repositoryInfo } = await transformZoektSearchResponse(response, reposMapCache);
131-
132-
resolve({
133-
stats,
134-
files,
135-
repositoryInfo,
136-
isSearchExhaustive: stats.actualMatchCount <= stats.totalMatchCount,
137-
} satisfies SearchResponse);
129+
(async () => {
130+
try {
131+
const reposMapCache = await createReposMapForChunk(response, new Map<string | number, Repo>(), prisma);
132+
const { stats, files, repositoryInfo } = await transformZoektSearchResponse(response, reposMapCache);
133+
134+
resolve({
135+
stats,
136+
files,
137+
repositoryInfo,
138+
isSearchExhaustive: stats.totalMatchCount <= stats.actualMatchCount,
139+
} satisfies SearchResponse);
140+
} catch (err) {
141+
reject(err);
142+
}
143+
})();
138144
});
139145
});
140146
}

0 commit comments

Comments
 (0)