Copilot commented on code in PR #4403:
URL: https://github.com/apache/texera/pull/4403#discussion_r3098084897


##########
frontend/src/app/dashboard/component/user/markdown-description/markdown-description.component.ts:
##########
@@ -140,8 +141,20 @@ export class MarkdownDescriptionComponent implements 
OnInit, OnChanges, AfterVie
   }
 
   renderMarkdown(text: string): void {
-    this.renderedDescription = text?.trim() ? this.markdownService.parse(text) 
: "";
-    this.scheduleOverflowCheck();
+    const currentRenderSequence = ++this.markdownRenderSequence;
+    if (!text?.trim()) {
+      this.renderedDescription = "";
+      this.scheduleOverflowCheck();
+      return;
+    }
+
+    Promise.resolve(this.markdownService.parse(text)).then(renderedDescription 
=> {
+      if (currentRenderSequence !== this.markdownRenderSequence) {
+        return;
+      }
+      this.renderedDescription = renderedDescription;
+      this.scheduleOverflowCheck();
+    });

Review Comment:
   `markdownService.parse()` can now resolve asynchronously; wrapping it with 
`Promise.resolve(...).then(...)` is fine, but this currently drops 
errors/rejections, which can surface as unhandled promise rejections and leave 
`renderedDescription` stale. Add a `.catch(...)` (and optionally a 
`finally`/error-path call to `scheduleOverflowCheck()`) while still honoring 
the `markdownRenderSequence` guard so failed parses don't break the component 
UI.
   ```suggestion
       Promise.resolve(this.markdownService.parse(text))
         .then(renderedDescription => {
           if (currentRenderSequence !== this.markdownRenderSequence) {
             return;
           }
           this.renderedDescription = renderedDescription;
           this.scheduleOverflowCheck();
         })
         .catch(() => {
           if (currentRenderSequence !== this.markdownRenderSequence) {
             return;
           }
           this.renderedDescription = "";
           this.scheduleOverflowCheck();
         });
   ```



##########
frontend/package.json:
##########
@@ -21,19 +21,19 @@
   },
   "private": true,
   "dependencies": {
-    "@abacritt/angularx-social-login": "2.3.0",
+    "@abacritt/angularx-social-login": "2.2.0",

Review Comment:
   This changes `@abacritt/angularx-social-login` from 2.3.0 to 2.2.0 (a 
downgrade), but the PR description only mentions upgrades. If this downgrade is 
intentional (e.g., peer dependency compatibility with Angular 17), please call 
it out in the PR description; otherwise consider keeping the newer version to 
avoid unintentionally regressing auth behavior.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to