Meilleure fluidité lorsqu'un tire un défi
This commit is contained in:
parent
bd5e39094b
commit
47ec3da6df
@ -6,6 +6,7 @@ import { useChallengeActions } from '@/hooks/useChallengeActions'
|
||||
import { useChallenges } from '@/hooks/useChallenges'
|
||||
import { useGame } from '@/hooks/useGame'
|
||||
import { FontAwesome6 } from '@expo/vector-icons'
|
||||
import { useQueryClient } from '@tanstack/react-query'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { View } from 'react-native'
|
||||
import { ActivityIndicator, Appbar, Banner, FAB, MD3Colors, Surface, Text, TouchableRipple } from 'react-native-paper'
|
||||
@ -21,6 +22,7 @@ function ChallengeScreenHeader() {
|
||||
}
|
||||
|
||||
function ChallengeScreenBody() {
|
||||
const queryClient = useQueryClient()
|
||||
const auth = useAuth()
|
||||
const game = useGame()
|
||||
const challengeActions = useChallengeActions()
|
||||
@ -38,7 +40,10 @@ function ChallengeScreenBody() {
|
||||
const [loading, setLoading] = useState(false)
|
||||
const drawRandomChallengeMutation = useDrawRandomChallengeMutation({
|
||||
auth,
|
||||
onPostSuccess: () => setLoading(true),
|
||||
onPostSuccess: () => {
|
||||
setLoading(true)
|
||||
queryClient.invalidateQueries({ predicate: (query) => query.queryKey[0] === 'get-challenges' || query.queryKey[0] === 'get-player' })
|
||||
}
|
||||
})
|
||||
useEffect(() => {
|
||||
if (challengeActions)
|
||||
|
Loading…
Reference in New Issue
Block a user