Skip to content

Commit

Permalink
fix length not showing up
Browse files Browse the repository at this point in the history
  • Loading branch information
dyc3 committed Jun 20, 2024
1 parent 870bc30 commit aa69801
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions client/src/components/AddPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ async function requestAddPreviewExplicit() {
isLoadingAddPreview.value = true;
hasAddPreviewFailed.value = false;
videos.value = [];
highlightedAddPreviewItem.value = undefined;
await requestAddPreview();
}
async function addAllToQueue() {
Expand All @@ -261,16 +262,19 @@ function onInputAddPreviewChange() {
hasAddPreviewFailed.value = false;
if (!inputAddPreview.value || _.trim(inputAddPreview.value).length === 0) {
videos.value = [];
highlightedAddPreviewItem.value = undefined;
return;
}
if (!isAddPreviewInputUrl.value) {
videos.value = [];
highlightedAddPreviewItem.value = undefined;
// Don't send API requests for non URL inputs without the user's explicit input to do so.
// This is to help conserve youtube API quota.
return;
}
isLoadingAddPreview.value = true;
videos.value = [];
highlightedAddPreviewItem.value = undefined;
requestAddPreviewDebounced();
}
function onInputAddPreviewKeyDown(e) {
Expand Down
18 changes: 10 additions & 8 deletions server/infoextractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,14 +383,16 @@ export default {
return new AddPreview(completeResults, cacheDuration);
} else {
const videos = fetchResults.videos;
const completeResults = await this.getManyVideoInfo(videos);
return new AddPreview(
{
videos: completeResults,
highlighted: fetchResults.highlighted,
},
cacheDuration
);
const completeResults: BulkVideoResult = {
videos: await this.getManyVideoInfo(videos),
highlighted: fetchResults.highlighted
? await this.getVideoInfo(
fetchResults.highlighted.service,
fetchResults.highlighted.id
)
: undefined,
};
return new AddPreview(completeResults, cacheDuration);

Check warning on line 395 in server/infoextractor.ts

View check run for this annotation

Codecov / codecov/patch

server/infoextractor.ts#L382-L395

Added lines #L382 - L395 were not covered by tests
}
} else {
if (query.length < ADD_PREVIEW_SEARCH_MIN_LENGTH) {
Expand Down

0 comments on commit aa69801

Please sign in to comment.