From d16cd501d4739eacfadc220396f429a8efcdcc5d Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Tue, 7 Nov 2023 07:59:59 +0800 Subject: [PATCH] Quick fix for pinned post not showing pin _pinned no longer stored with post, so pinned posts now can't be reactive --- src/components/timeline.jsx | 4 +++- src/pages/account-statuses.jsx | 11 +++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/timeline.jsx b/src/components/timeline.jsx index 2addc741..e71c569e 100644 --- a/src/components/timeline.jsx +++ b/src/components/timeline.jsx @@ -461,6 +461,7 @@ function TimelineItem({ view, }) { const { id: statusID, reblog, items, type, _pinned } = status; + if (_pinned) useItemID = false; const actualStatusID = reblog?.id || statusID; const url = instance ? `/${instance}/s/${actualStatusID}` @@ -496,11 +497,12 @@ function TimelineItem({
  • diff --git a/src/pages/account-statuses.jsx b/src/pages/account-statuses.jsx index f7c61465..bd6c296a 100644 --- a/src/pages/account-statuses.jsx +++ b/src/pages/account-statuses.jsx @@ -152,16 +152,19 @@ function AccountStatuses() { const results = []; if (firstLoad) { - const { value: pinnedStatuses } = await masto.v1.accounts + const { value } = await masto.v1.accounts .$select(id) .statuses.list({ pinned: true, }) .next(); - if (pinnedStatuses?.length && !tagged && !media) { - pinnedStatuses.forEach((status) => { + if (value?.length && !tagged && !media) { + const pinnedStatuses = value.map((status) => { saveStatus(status, instance); - status._pinned = true; + return { + ...status, + _pinned: true, + }; }); if (pinnedStatuses.length >= 3) { const pinnedStatusesIds = pinnedStatuses.map((status) => status.id);