From e6909d4cd1e67f5ebb890eaa34be3c6dbf2b2bdd Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Mon, 26 Jun 2023 09:25:00 -0400 Subject: [PATCH 1/3] fix bug collapsing previews when voting --- src/shared/components/post/post-listing.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 449f6963..c423b2ce 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -42,6 +42,7 @@ import { SavePost, TransferCommunity, } from "lemmy-js-client"; +import deepEqual from "lodash.isequal"; import { relTags } from "../../config"; import { BanType, @@ -168,7 +169,7 @@ export class PostListing extends Component { } componentWillReceiveProps(nextProps: PostListingProps) { - if (this.props !== nextProps) { + if (!deepEqual(this.props, nextProps)) { this.setState({ purgeLoading: false, reportLoading: false, @@ -183,7 +184,6 @@ export class PostListing extends Component { addModLoading: false, addAdminLoading: false, transferLoading: false, - imageExpanded: false, }); } } From 81131d2804076860cdbb0deda89923b410da9483 Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Mon, 26 Jun 2023 12:16:32 -0400 Subject: [PATCH 2/3] remove hook entirely --- src/shared/components/post/post-listing.tsx | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index c423b2ce..ca9f9dad 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -42,7 +42,6 @@ import { SavePost, TransferCommunity, } from "lemmy-js-client"; -import deepEqual from "lodash.isequal"; import { relTags } from "../../config"; import { BanType, @@ -168,26 +167,6 @@ export class PostListing extends Component { this.handleEditCancel = this.handleEditCancel.bind(this); } - componentWillReceiveProps(nextProps: PostListingProps) { - if (!deepEqual(this.props, nextProps)) { - this.setState({ - purgeLoading: false, - reportLoading: false, - blockLoading: false, - lockLoading: false, - deleteLoading: false, - removeLoading: false, - saveLoading: false, - featureCommunityLoading: false, - featureLocalLoading: false, - banLoading: false, - addModLoading: false, - addAdminLoading: false, - transferLoading: false, - }); - } - } - get postView(): PostView { return this.props.post_view; } From 2b1647c9b8c479daef8ce3fb711b394e49f6ccce Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Mon, 26 Jun 2023 17:04:19 -0400 Subject: [PATCH 3/3] partially revert change --- src/shared/components/post/post-listing.tsx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index dd6ba0cd..7b75818c 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -167,6 +167,26 @@ export class PostListing extends Component { this.handleEditCancel = this.handleEditCancel.bind(this); } + componentWillReceiveProps(nextProps: PostListingProps) { + if (this.props !== nextProps) { + this.setState({ + purgeLoading: false, + reportLoading: false, + blockLoading: false, + lockLoading: false, + deleteLoading: false, + removeLoading: false, + saveLoading: false, + featureCommunityLoading: false, + featureLocalLoading: false, + banLoading: false, + addModLoading: false, + addAdminLoading: false, + transferLoading: false, + }); + } + } + get postView(): PostView { return this.props.post_view; }