fix "fetch user info during animation sync"

This commit is contained in:
Hazel K 2024-10-03 12:03:21 -04:00
parent 21b935aa78
commit d82c0ddba9
1 changed files with 17 additions and 16 deletions

View File

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