mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-25 01:08:50 +01:00
Fix noob mistake
And also make announcements and follow requests fetch more non-blocking
This commit is contained in:
parent
678fc100c8
commit
540b9a15a4
1 changed files with 17 additions and 12 deletions
|
@ -134,11 +134,10 @@ function Notifications({ columnMode }) {
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
const fetchNotificationsPromise = fetchNotifications(firstLoad);
|
const fetchNotificationsPromise = fetchNotifications(firstLoad);
|
||||||
const fetchFollowRequestsPromise = fetchFollowRequests();
|
|
||||||
const fetchAnnouncementsPromise = fetchAnnouncements();
|
|
||||||
|
|
||||||
if (firstLoad) {
|
if (firstLoad) {
|
||||||
const announcements = await fetchAnnouncementsPromise;
|
fetchAnnouncements()
|
||||||
|
.then((announcements) => {
|
||||||
announcements.sort((a, b) => {
|
announcements.sort((a, b) => {
|
||||||
// Sort by updatedAt first, then createdAt
|
// Sort by updatedAt first, then createdAt
|
||||||
const aDate = new Date(a.updatedAt || a.createdAt);
|
const aDate = new Date(a.updatedAt || a.createdAt);
|
||||||
|
@ -146,8 +145,14 @@ function Notifications({ columnMode }) {
|
||||||
return bDate - aDate;
|
return bDate - aDate;
|
||||||
});
|
});
|
||||||
setAnnouncements(announcements);
|
setAnnouncements(announcements);
|
||||||
const requests = await fetchFollowRequestsPromise;
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
|
||||||
|
fetchFollowRequests()
|
||||||
|
.then((requests) => {
|
||||||
setFollowRequests(requests);
|
setFollowRequests(requests);
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
const { done } = await fetchNotificationsPromise;
|
const { done } = await fetchNotificationsPromise;
|
||||||
|
|
Loading…
Reference in a new issue