This commit is contained in:
2025-05-21 18:03:22 +03:00
parent 4419151510
commit 074d6674b8
34 changed files with 99 additions and 79 deletions

View File

@@ -16,7 +16,7 @@ type UsersStore = {
const usersFetcher = batshitCreate({
fetcher: async (userIds: UserId[]) => {
let users = [];
const users = [];
for (const userId of userIds) {
users.push(getUser(userId));
@@ -32,7 +32,7 @@ export const useUsersStore = create<UsersStore>()(
users: {},
currentUserId: undefined,
fetchUsersIfNotPresent: async (userIds) => {
let userPromises: Promise<PartialUser>[] = [];
const userPromises: Promise<PartialUser>[] = [];
for (const userId of userIds) {
const user = get().users[userId];
if (!user) {
@@ -68,6 +68,6 @@ export const useUsersStore = create<UsersStore>()(
state.currentUserId = userId;
}),
getCurrentUser: () => (!!get().currentUserId ? (get().users[get().currentUserId!] as FullUser) : undefined),
getCurrentUser: () => (get().currentUserId ? (get().users[get().currentUserId!] as FullUser) : undefined),
})),
);