mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-22 16:46:28 +01:00
Make announcements appear faster
This commit is contained in:
parent
904e82872e
commit
da46171ef6
1 changed files with 6 additions and 4 deletions
|
@ -103,14 +103,11 @@ function Notifications() {
|
|||
setUIState('loading');
|
||||
(async () => {
|
||||
try {
|
||||
const fetchNotificationsPromise = fetchNotifications(firstLoad);
|
||||
const fetchFollowRequestsPromise = fetchFollowRequests();
|
||||
const fetchAnnouncementsPromise = fetchAnnouncements();
|
||||
const { done } = await fetchNotifications(firstLoad);
|
||||
setShowMore(!done);
|
||||
|
||||
if (firstLoad) {
|
||||
const requests = await fetchFollowRequestsPromise;
|
||||
setFollowRequests(requests);
|
||||
const announcements = await fetchAnnouncementsPromise;
|
||||
announcements.sort((a, b) => {
|
||||
// Sort by updatedAt first, then createdAt
|
||||
|
@ -119,8 +116,13 @@ function Notifications() {
|
|||
return bDate - aDate;
|
||||
});
|
||||
setAnnouncements(announcements);
|
||||
const requests = await fetchFollowRequestsPromise;
|
||||
setFollowRequests(requests);
|
||||
}
|
||||
|
||||
const { done } = await fetchNotificationsPromise;
|
||||
setShowMore(!done);
|
||||
|
||||
setUIState('default');
|
||||
} catch (e) {
|
||||
setUIState('error');
|
||||
|
|
Loading…
Reference in a new issue