From f0eb684412a01a171034d79ddb70421217dfed6f Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sun, 19 Feb 2023 00:05:46 +0800 Subject: [PATCH] Got to instance them all --- src/pages/bookmarks.jsx | 3 ++- src/pages/favourites.jsx | 3 ++- src/pages/following.jsx | 1 + src/pages/list.jsx | 3 ++- src/pages/notifications.jsx | 12 +++++++++--- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/pages/bookmarks.jsx b/src/pages/bookmarks.jsx index 94a7cd16..f811aa7a 100644 --- a/src/pages/bookmarks.jsx +++ b/src/pages/bookmarks.jsx @@ -8,7 +8,7 @@ const LIMIT = 20; function Bookmarks() { useTitle('Bookmarks', '/b'); - const { masto } = api(); + const { masto, instance } = api(); const bookmarksIterator = useRef(); async function fetchBookmarks(firstLoad) { if (firstLoad || !bookmarksIterator.current) { @@ -23,6 +23,7 @@ function Bookmarks() { id="bookmarks" emptyText="No bookmarks yet. Go bookmark something!" errorText="Unable to load bookmarks" + instance={instance} fetchItems={fetchBookmarks} /> ); diff --git a/src/pages/favourites.jsx b/src/pages/favourites.jsx index 5b295ce6..24732ece 100644 --- a/src/pages/favourites.jsx +++ b/src/pages/favourites.jsx @@ -8,7 +8,7 @@ const LIMIT = 20; function Favourites() { useTitle('Favourites', '/f'); - const { masto } = api(); + const { masto, instance } = api(); const favouritesIterator = useRef(); async function fetchFavourites(firstLoad) { if (firstLoad || !favouritesIterator.current) { @@ -23,6 +23,7 @@ function Favourites() { id="favourites" emptyText="No favourites yet. Go favourite something!" errorText="Unable to load favourites" + instance={instance} fetchItems={fetchFavourites} /> ); diff --git a/src/pages/following.jsx b/src/pages/following.jsx index 364e56bb..4f3d03de 100644 --- a/src/pages/following.jsx +++ b/src/pages/following.jsx @@ -113,6 +113,7 @@ function Following({ title, path, id, ...props }) { id={id || 'following'} emptyText="Nothing to see here." errorText="Unable to load posts." + instance={instance} fetchItems={fetchHome} checkForUpdates={checkForUpdates} useItemID diff --git a/src/pages/list.jsx b/src/pages/list.jsx index e3097d0a..f8cddef2 100644 --- a/src/pages/list.jsx +++ b/src/pages/list.jsx @@ -10,7 +10,7 @@ import useTitle from '../utils/useTitle'; const LIMIT = 20; function List(props) { - const { masto } = api(); + const { masto, instance } = api(); const id = props?.id || useParams()?.id; const latestItem = useRef(); @@ -66,6 +66,7 @@ function List(props) { id="list" emptyText="Nothing yet." errorText="Unable to load posts." + instance={instance} fetchItems={fetchList} checkForUpdates={checkForUpdates} boostsCarousel diff --git a/src/pages/notifications.jsx b/src/pages/notifications.jsx index a4131e24..80bfd8d9 100644 --- a/src/pages/notifications.jsx +++ b/src/pages/notifications.jsx @@ -50,7 +50,7 @@ const LIMIT = 30; // 30 is the maximum limit :( function Notifications() { useTitle('Notifications', '/notifications'); - const { masto } = api(); + const { masto, instance } = api(); const snapStates = useSnapshot(states); const [uiState, setUIState] = useState('default'); const [showMore, setShowMore] = useState(false); @@ -227,6 +227,7 @@ function Notifications() { <> {differentDay &&

{heading}

} @@ -279,7 +280,7 @@ function Notifications() { ); } -function Notification({ notification }) { +function Notification({ notification, instance }) { const { id, type, status, account, _accounts } = notification; // status = Attached when type of the notification is favourite, reblog, status, mention, poll, or update @@ -392,7 +393,11 @@ function Notification({ notification }) { {status && ( @@ -403,6 +408,7 @@ function Notification({ notification }) { } function FollowRequestButtons({ accountID, onChange }) { + const { masto } = api(); const [uiState, setUIState] = useState('default'); return (