More improvements
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
const replyText: string = comment.replies?.replyCount > 1 ? $_('replies') : $_('reply');
|
||||
|
||||
async function loadReplies(continuation: string) {
|
||||
if (comment.getReplies) {
|
||||
if (comment?.getReplies) {
|
||||
replies = await comment.getReplies();
|
||||
} else {
|
||||
try {
|
||||
|
||||
@@ -73,9 +73,12 @@
|
||||
|
||||
const searchCacheItem = $searchCacheStore[data.searchStoreId];
|
||||
|
||||
if (searchCacheItem.getContinuation) {
|
||||
if (searchCacheItem?.getContinuation) {
|
||||
newSearch = await searchCacheItem.getContinuation();
|
||||
searchCacheItem.getContinuation = newSearch.getContinuation;
|
||||
|
||||
if (newSearch.getContinuation) {
|
||||
searchCacheItem.getContinuation = newSearch.getContinuation;
|
||||
}
|
||||
} else {
|
||||
currentPage++;
|
||||
searchOptions = {
|
||||
@@ -84,6 +87,11 @@
|
||||
};
|
||||
|
||||
newSearch = await getSearch(data.slug, searchOptions);
|
||||
|
||||
// Set the continuation method if it exists
|
||||
if (newSearch.getContinuation) {
|
||||
searchCacheItem.getContinuation = newSearch.getContinuation;
|
||||
}
|
||||
}
|
||||
|
||||
if (newSearch.length === 0) {
|
||||
@@ -92,7 +100,6 @@
|
||||
searchCacheStore.set({
|
||||
[data.searchStoreId]: [...(searchCacheItem ?? []), ...newSearch]
|
||||
});
|
||||
event.detail.loaded();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -349,16 +349,25 @@
|
||||
}
|
||||
|
||||
let loadedComments: Comments;
|
||||
if (comments.getContinuation) {
|
||||
loadedComments = await comments.getContinuation();
|
||||
} else {
|
||||
loadedComments = await getComments(data.video.videoId, {
|
||||
continuation: comments?.continuation
|
||||
});
|
||||
}
|
||||
|
||||
comments.continuation = loadedComments.continuation;
|
||||
comments.comments = [...comments.comments, ...loadedComments.comments];
|
||||
try {
|
||||
if (comments.getContinuation) {
|
||||
loadedComments = await comments.getContinuation();
|
||||
} else if (comments.continuation) {
|
||||
loadedComments = await getComments(data.video.videoId, {
|
||||
continuation: comments.continuation
|
||||
});
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (loadedComments.comments.length > 0) {
|
||||
comments.continuation = loadedComments.continuation;
|
||||
comments.comments = [...comments.comments, ...loadedComments.comments];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error loading more comments:', error);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleTheatreMode() {
|
||||
|
||||
Reference in New Issue
Block a user