@@ -28,6 +28,10 @@ import {
2828 isNumber
2929} from '@/lib/common.ts' ;
3030
31+ import {
32+ generateRandomUUID
33+ } from '@/lib/misc.ts' ;
34+
3135import {
3236 getCurrentUserInfo ,
3337 updateCurrentUserInfo ,
@@ -40,6 +44,7 @@ import services from '@/lib/services.ts';
4044export const useUserStore = defineStore ( 'user' , ( ) => {
4145 const settingsStore = useSettingsStore ( ) ;
4246 const currentUserBasicInfo = ref < UserBasicInfo | null > ( getCurrentUserInfo ( ) ) ;
47+ const currentUserAvatarNoCacheId = ref < string > ( generateRandomUUID ( ) ) ;
4348
4449 const currentUserNickname = computed < string | null > ( ( ) => {
4550 const userInfo = currentUserBasicInfo . value || EMPTY_USER_BASIC_INFO ;
@@ -48,7 +53,7 @@ export const useUserStore = defineStore('user', () => {
4853
4954 const currentUserAvatar = computed < string | null > ( ( ) => {
5055 const userInfo = currentUserBasicInfo . value || EMPTY_USER_BASIC_INFO ;
51- return getUserAvatarUrl ( userInfo , false ) ;
56+ return getUserAvatarUrl ( userInfo , currentUserAvatarNoCacheId . value ) ;
5257 } ) ;
5358
5459 const currentUserDefaultAccountId = computed < string > ( ( ) => {
@@ -167,6 +172,7 @@ export const useUserStore = defineStore('user', () => {
167172
168173 function resetUserBasicInfo ( ) : void {
169174 currentUserBasicInfo . value = null ;
175+ currentUserAvatarNoCacheId . value = generateRandomUUID ( ) ;
170176 clearCurrentUserInfo ( ) ;
171177 }
172178
@@ -233,6 +239,7 @@ export const useUserStore = defineStore('user', () => {
233239 }
234240
235241 storeUserBasicInfo ( data . result ) ;
242+ currentUserAvatarNoCacheId . value = generateRandomUUID ( ) ;
236243
237244 resolve ( data . result ) ;
238245 } ) . catch ( error => {
0 commit comments