feat(ui): add emoji picker with FlatList virtualization and improve input components
- Add full emoji picker with virtualized FlatList to CreatePostScreen and PostDetailScreen - Add autoExpand prop to PostMentionInput for XHS-style content area - Improve mention item styling with @ icon and hint text - Fix HomeScreen tab switching race condition with requestAnimationFrame - Fix PostRepository pagination to prefer cursor over page parameter - Fix user store imports to use explicit UserManager path - Refactor useCurrentUser hook to use sessionStore directly
This commit is contained in:
@@ -265,7 +265,7 @@ export const useAuthStore = create<AuthState>((set) => ({
|
||||
// 7. 清除 sessionStore 的 userId
|
||||
useSessionStore.getState().setUserId(null);
|
||||
// 8. 清除 userManager 的内存缓存
|
||||
const { userManager } = await import('../user');
|
||||
const { userManager } = await import('../user/UserManager');
|
||||
userManager.invalidateUsers();
|
||||
} catch (error) {
|
||||
console.error('[AuthStore] 登出失败:', error);
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
import { webrtcManager, ICEServer } from '@/services/webrtc';
|
||||
import { getCurrentUserId } from '../auth/sessionStore';
|
||||
import { useUserStore } from '../userStore';
|
||||
import { userManager } from '../user';
|
||||
import { userManager } from '../user/UserManager';
|
||||
|
||||
export type CallStatus =
|
||||
| 'idle' // 空闲状态
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef } from 'react';
|
||||
import { useUserManagerStore } from './userStore';
|
||||
import { userManager } from './UserManager';
|
||||
import type { UserDTO } from '../../types/dto';
|
||||
import { useAuthStore } from '../auth/authStore';
|
||||
import { useSessionStore } from '../auth/sessionStore';
|
||||
|
||||
export interface UseCurrentUserResult {
|
||||
user: UserDTO | null;
|
||||
@@ -16,8 +16,7 @@ export function useCurrentUser(): UseCurrentUserResult {
|
||||
const lastFetchedRef = useRef<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const authUser = useAuthStore.getState().currentUser;
|
||||
const userId = authUser?.id;
|
||||
const userId = useSessionStore.getState().userId;
|
||||
if (userId && lastFetchedRef.current !== userId) {
|
||||
lastFetchedRef.current = userId;
|
||||
useUserManagerStore.getState().setLoadingCurrentUser(true);
|
||||
@@ -28,8 +27,8 @@ export function useCurrentUser(): UseCurrentUserResult {
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
return useAuthStore.subscribe((state, prev) => {
|
||||
if (!state.currentUser && prev.currentUser) {
|
||||
return useSessionStore.subscribe((state, prev) => {
|
||||
if (!state.userId && prev.userId) {
|
||||
lastFetchedRef.current = null;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
postService,
|
||||
notificationService,
|
||||
} from '../services';
|
||||
import { userManager } from './user';
|
||||
import { userManager } from './user/UserManager';
|
||||
import { messageManager } from './message';
|
||||
|
||||
interface UserState {
|
||||
|
||||
Reference in New Issue
Block a user