From: Dessalines Date: Mon, 22 Nov 2021 20:04:20 +0000 (-0500) Subject: A few fixes. X-Git-Url: http://these/git/readmes/%7B%60https:/%7Bsrc%7D?a=commitdiff_plain;h=d6f651568b704dab7890fda68495eb2d12e4a0ee;p=lemmy-ui.git A few fixes. --- diff --git a/src/shared/components/home/signup.tsx b/src/shared/components/home/signup.tsx index 1bc3472..ebccac9 100644 --- a/src/shared/components/home/signup.tsx +++ b/src/shared/components/home/signup.tsx @@ -426,7 +426,7 @@ export class Signup extends Component { 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 { diff --git a/src/shared/components/person/profile.tsx b/src/shared/components/person/profile.tsx index 3f4f300..c12038f 100644 --- a/src/shared/components/person/profile.tsx +++ b/src/shared/components/person/profile.tsx @@ -606,7 +606,7 @@ export class Profile extends Component { 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")); } diff --git a/src/shared/components/post/post.tsx b/src/shared/components/post/post.tsx index f68d77a..4c7f502 100644 --- a/src/shared/components/post/post.tsx +++ b/src/shared/components/post/post.tsx @@ -269,7 +269,7 @@ export class Post extends Component { } isBottom(el: Element) { - return el.getBoundingClientRect().bottom <= window.innerHeight; + return el?.getBoundingClientRect().bottom <= window.innerHeight; } /** @@ -277,7 +277,7 @@ export class Post extends Component { */ trackCommentsBoxScrolling = () => { const wrappedElement = document.getElementsByClassName("comments")[0]; - if (this.isBottom(wrappedElement)) { + if (wrappedElement && this.isBottom(wrappedElement)) { this.state.maxCommentsShown += commentsShownInterval; this.setState(this.state); } diff --git a/src/shared/components/search.tsx b/src/shared/components/search.tsx index 5257489..596b7e5 100644 --- a/src/shared/components/search.tsx +++ b/src/shared/components/search.tsx @@ -809,10 +809,14 @@ export class Search extends Component { 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 );