-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(hot): avoid image caching on profile
- Loading branch information
Showing
12 changed files
with
475 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import {selector} from 'recoil'; | ||
import {authRecoilState, UserInfo} from './atoms'; | ||
|
||
export const authRecoilSelector = selector<UserInfo>({ | ||
key: 'authRecoilSelector', | ||
get: ({get}) => { | ||
const state = get(authRecoilState); | ||
|
||
if (state.user?.avatar_url) { | ||
return { | ||
...state, | ||
user: { | ||
...state.user, | ||
avatar_url: `${state.user.avatar_url}?${new Date().toISOString()}`, | ||
}, | ||
}; | ||
} | ||
return state; | ||
}, | ||
set: ({set, get}, newValue) => { | ||
const newUserInfo = newValue as UserInfo; | ||
|
||
if (newUserInfo.user?.avatar_url) { | ||
newUserInfo.user.avatar_url = `${newUserInfo.user.avatar_url}?${new Date().toISOString()}`; | ||
} | ||
set(authRecoilState, newUserInfo); | ||
}, | ||
}); |
Oops, something went wrong.