perf: optimize load of pagination items with caching

This commit is contained in:
Divlo
2022-08-24 17:22:55 +02:00
parent 19fc29ad47
commit ad64f1c571
16 changed files with 168 additions and 65 deletions

View File

@ -22,12 +22,15 @@ export const JoinGuildsPublic: React.FC = () => {
})
useEffect(() => {
authentication.socket.on('guilds', (data: SocketData<GuildPublicType>) => {
handleSocketData({ data, setItems })
})
authentication?.socket?.on(
'guilds',
(data: SocketData<GuildPublicType>) => {
handleSocketData({ data, setItems })
}
)
return () => {
authentication.socket.off('guilds')
authentication?.socket?.off('guilds')
}
}, [authentication.socket, setItems])

View File

@ -72,7 +72,7 @@ export const Authentication: React.FC<AuthenticationProps> = (props) => {
} else {
try {
const { data } = await api.post<Tokens>('/users/signin', formData)
const authentication = new AuthenticationClass(data)
const authentication = new AuthenticationClass(data, true)
authentication.signin()
await router.push('/application')
return null

View File

@ -24,7 +24,7 @@ export const AuthenticationSocialMedia: React.FC = () => {
useEffect(() => {
const data = router.query
if (isTokens(data)) {
const authentication = new Authentication(data)
const authentication = new Authentication(data, true)
authentication.signin()
router.push('/application').catch(() => {})
}