From 422588178a4ee704c89a243d1a5bb45eeb0af02c Mon Sep 17 00:00:00 2001 From: Mary Kate Date: Sat, 15 Aug 2020 15:19:18 -0500 Subject: [PATCH] loading improvments for profile media panel --- .../ui/components/profile_media_panel.js | 42 +++++++++++-------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/app/soapbox/features/ui/components/profile_media_panel.js b/app/soapbox/features/ui/components/profile_media_panel.js index 7d01a2f5a..200813156 100644 --- a/app/soapbox/features/ui/components/profile_media_panel.js +++ b/app/soapbox/features/ui/components/profile_media_panel.js @@ -35,13 +35,19 @@ class ProfileMediaPanel extends ImmutablePureComponent { this.props.dispatch(expandAccountMediaTimeline(accountId)); } - render() { - const { attachments } = this.props; - const nineAttachments = attachments.slice(0, 9); + componentDidUpdate() { + const { account } = this.props; + const accountId = account.get('id'); + this.props.dispatch(expandAccountMediaTimeline(accountId)); + } - if (attachments.isEmpty()) { - return null; - } + render() { + const { attachments, account } = this.props; + const nineAttachments = attachments.slice(0, 9); + // + // if (attachments.isEmpty()) { + // return null; + // } return (
@@ -51,18 +57,20 @@ class ProfileMediaPanel extends ImmutablePureComponent {
-
-
- {nineAttachments.map((attachment, index) => ( - - ))} + {account && +
+
+ {!nineAttachments.isEmpty() && nineAttachments.map((attachment, index) => ( + + ))} +
-
+ }
); };