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