mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-23 14:13:21 +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');
|
setUIState('loading');
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
|
const fetchNotificationsPromise = fetchNotifications(firstLoad);
|
||||||
const fetchFollowRequestsPromise = fetchFollowRequests();
|
const fetchFollowRequestsPromise = fetchFollowRequests();
|
||||||
const fetchAnnouncementsPromise = fetchAnnouncements();
|
const fetchAnnouncementsPromise = fetchAnnouncements();
|
||||||
const { done } = await fetchNotifications(firstLoad);
|
|
||||||
setShowMore(!done);
|
|
||||||
|
|
||||||
if (firstLoad) {
|
if (firstLoad) {
|
||||||
const requests = await fetchFollowRequestsPromise;
|
|
||||||
setFollowRequests(requests);
|
|
||||||
const announcements = await fetchAnnouncementsPromise;
|
const announcements = await fetchAnnouncementsPromise;
|
||||||
announcements.sort((a, b) => {
|
announcements.sort((a, b) => {
|
||||||
// Sort by updatedAt first, then createdAt
|
// Sort by updatedAt first, then createdAt
|
||||||
|
@ -119,8 +116,13 @@ function Notifications() {
|
||||||
return bDate - aDate;
|
return bDate - aDate;
|
||||||
});
|
});
|
||||||
setAnnouncements(announcements);
|
setAnnouncements(announcements);
|
||||||
|
const requests = await fetchFollowRequestsPromise;
|
||||||
|
setFollowRequests(requests);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { done } = await fetchNotificationsPromise;
|
||||||
|
setShowMore(!done);
|
||||||
|
|
||||||
setUIState('default');
|
setUIState('default');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setUIState('error');
|
setUIState('error');
|
||||||
|
|
Loading…
Add table
Reference in a new issue