mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-29 17:02:28 +00:00
Handle synchronous comment snapshots in video modal
This commit is contained in:
1 parent
9d859b07ed
commit
2c8066fd9d
2 files changed
+68
-6
No files matched your search
@@ -202,21 +202,29 @@ export default class VideoModalCommentController {
|
||||
this.videoModal.resetCommentComposer?.();
|
||||
this.videoModal.setCommentStatus?.("Loading comments…");
|
||||
|
||||
const loadPromise = this.commentThreadService.loadThread({
|
||||
const loadResult = this.commentThreadService.loadThread({
|
||||
video,
|
||||
parentCommentId: null,
|
||||
limit: this.modalCommentLimit,
|
||||
});
|
||||
|
||||
if (!loadPromise || typeof loadPromise.then !== "function") {
|
||||
if (!loadResult) {
|
||||
this.applyCommentComposerAuthState();
|
||||
return;
|
||||
}
|
||||
|
||||
this.modalCommentLoadPromise = loadPromise;
|
||||
loadPromise
|
||||
if (typeof loadResult.then !== "function") {
|
||||
const didRenderSnapshot = this.handleCommentThreadReady(loadResult);
|
||||
if (didRenderSnapshot === false) {
|
||||
this.applyCommentComposerAuthState();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this.modalCommentLoadPromise = loadResult;
|
||||
loadResult
|
||||
.then((snapshot) => {
|
||||
if (this.modalCommentLoadPromise === loadPromise) {
|
||||
if (this.modalCommentLoadPromise === loadResult) {
|
||||
this.modalCommentLoadPromise = null;
|
||||
}
|
||||
|
||||
@@ -226,7 +234,7 @@ export default class VideoModalCommentController {
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
if (this.modalCommentLoadPromise === loadPromise) {
|
||||
if (this.modalCommentLoadPromise === loadResult) {
|
||||
this.modalCommentLoadPromise = null;
|
||||
}
|
||||
this.handleCommentThreadError(error);
|
||||
|
||||
Reference in new issue
Block a user