fetch user info during animation sync

This commit is contained in:
Hazel K 2024-10-03 11:32:51 -04:00
parent 9b572be0df
commit 2fbb697bf9

View file

@ -114,13 +114,14 @@ async function showUserNotes(userId: string): Promise<void> {
selectedUser.value = null; selectedUser.value = null;
if (userId) { if (userId) {
await Promise.all([
// Wait for 1 second to match the animation effects in MkHorizontalSwipe, MkPullToRefresh, and MkPagination. // Wait for 1 second to match the animation effects in MkHorizontalSwipe, MkPullToRefresh, and MkPagination.
// Otherwise, the page appears to load "backwards". // Otherwise, the page appears to load "backwards".
await new Promise(resolve => setTimeout(resolve, 1000)); new Promise(resolve => setTimeout(resolve, 1000)),
// We need a User entity, but the pagination returns only UserLite. // We need a User entity, but the pagination returns only UserLite.
// An additional request is needed to "upgrade" the object. // An additional request is needed to "upgrade" the object.
await misskeyApi('users/show', { userId }) misskeyApi('users/show', { userId })
.then(user => selectedUser.value = user) .then(user => selectedUser.value = user)
.catch(error => { .catch(error => {
console.error('Error fetching user info', error); console.error('Error fetching user info', error);
@ -129,7 +130,8 @@ async function showUserNotes(userId: string): Promise<void> {
typeof(error) === 'string' typeof(error) === 'string'
? String(error) ? String(error)
: JSON.stringify(error); : JSON.stringify(error);
}); }),
]);
} }
} }