]> Untitled Git - lemmy-ui.git/commitdiff
A few fixes.
authorDessalines <tyhou13@gmx.com>
Mon, 22 Nov 2021 20:04:20 +0000 (15:04 -0500)
committerDessalines <tyhou13@gmx.com>
Mon, 22 Nov 2021 20:04:20 +0000 (15:04 -0500)
src/shared/components/home/signup.tsx
src/shared/components/person/profile.tsx
src/shared/components/post/post.tsx
src/shared/components/search.tsx

index 1bc3472a4340b588f0d329ae0ca3d02c9949efaf..ebccac9893610f17f5e5162ee9dcb57adc5bc832 100644 (file)
@@ -426,7 +426,7 @@ export class Signup extends Component<any, State> {
       this.state = this.emptyState;
       this.state.registerForm.captcha_answer = undefined;
       // Refetch another captcha
-      WebSocketService.Instance.send(wsClient.getCaptcha());
+      // WebSocketService.Instance.send(wsClient.getCaptcha());
       this.setState(this.state);
       return;
     } else {
index 3f4f30035a7d05ea380087aef4b6fbc9eed71d83..c12038f924c23d7d35eedfd0f66b5f07b38e0608 100644 (file)
@@ -606,7 +606,7 @@ export class Profile extends Component<any, ProfileState> {
       if (
         UserService.Instance.myUserInfo &&
         data.comment_view.creator.id ==
-          UserService.Instance.myUserInfo.local_user_view.person.id
+          UserService.Instance.myUserInfo?.local_user_view.person.id
       ) {
         toast(i18n.t("reply_sent"));
       }
index f68d77acc11c2812da7ec2430ad0dc1fca9b29f8..4c7f5021d72b3ddaf37205e2515fe2417c115939 100644 (file)
@@ -269,7 +269,7 @@ export class Post extends Component<any, PostState> {
   }
 
   isBottom(el: Element) {
-    return el.getBoundingClientRect().bottom <= window.innerHeight;
+    return el?.getBoundingClientRect().bottom <= window.innerHeight;
   }
 
   /**
@@ -277,7 +277,7 @@ export class Post extends Component<any, PostState> {
    */
   trackCommentsBoxScrolling = () => {
     const wrappedElement = document.getElementsByClassName("comments")[0];
-    if (this.isBottom(wrappedElement)) {
+    if (wrappedElement && this.isBottom(wrappedElement)) {
       this.state.maxCommentsShown += commentsShownInterval;
       this.setState(this.state);
     }
index 525748911ac7c730c266a3066ffb7414e9b9e328..596b7e59ce1aa37b34b51bd5ba7ea142aec42ee1 100644 (file)
@@ -809,10 +809,14 @@ export class Search extends Component<any, SearchState> {
         this.creatorChoices.passedElement.element.addEventListener(
           "search",
           debounce(async (e: any) => {
-            let creators = (await fetchUsers(e.detail.value)).users;
-            let choices = creators.map(pvs => personToChoice(pvs));
-            choices.unshift({ value: "0", label: i18n.t("all") });
-            this.creatorChoices.setChoices(choices, "value", "label", true);
+            try {
+              let creators = (await fetchUsers(e.detail.value)).users;
+              let choices = creators.map(pvs => personToChoice(pvs));
+              choices.unshift({ value: "0", label: i18n.t("all") });
+              this.creatorChoices.setChoices(choices, "value", "label", true);
+            } catch (err) {
+              console.log(err);
+            }
           }, 400),
           false
         );