1
0
mirror of https://github.com/tooot-app/app synced 2024-12-22 07:34:06 +01:00

Fix push server key data staled

This commit is contained in:
xmflsct 2022-12-10 13:38:26 +01:00
parent 88312e4df5
commit b449d50b78

View File

@ -35,12 +35,7 @@ const TabMePush: React.FC = () => {
const instance = useSelector(getInstance)
const expoToken = useSelector(getExpoToken)
const [serverKeyAvailable, setServerKeyAvailable] = useState<boolean>()
useAppsQuery({
options: {
onSuccess: data => setServerKeyAvailable(!!data.vapid_key)
}
})
const appsQuery = useAppsQuery()
const dispatch = useAppDispatch()
const instancePush = useSelector(getInstancePush)
@ -66,7 +61,7 @@ const TabMePush: React.FC = () => {
}
}
if (serverKeyAvailable) {
if (appsQuery.data?.vapid_key) {
checkPush()
if (isDevelopment) {
@ -80,7 +75,7 @@ const TabMePush: React.FC = () => {
return () => {
subscription.remove()
}
}, [serverKeyAvailable])
}, [appsQuery.data?.vapid_key])
const alerts = () =>
instancePush?.alerts
@ -133,7 +128,7 @@ const TabMePush: React.FC = () => {
return (
<ScrollView>
{!!serverKeyAvailable ? (
{!!appsQuery.data?.vapid_key ? (
<>
{!!pushAvailable ? (
<>