1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Better lookback update

This commit is contained in:
Zhiyuan Zheng
2022-01-30 22:51:03 +01:00
parent 45ba984ea3
commit bd49caa52a
13 changed files with 116 additions and 106 deletions

View File

@ -3,11 +3,11 @@ import Button from '@components/Button'
import haptics from '@components/haptics'
import ComponentInstance from '@components/Instance'
import { useNavigation } from '@react-navigation/native'
import initQuery from '@utils/initQuery'
import {
getInstanceActive,
getInstances,
Instance,
updateInstanceActive
Instance
} from '@utils/slices/instancesSlice'
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
@ -21,8 +21,7 @@ import {
View
} from 'react-native'
import { ScrollView } from 'react-native-gesture-handler'
import { useQueryClient } from 'react-query'
import { useDispatch, useSelector } from 'react-redux'
import { useSelector } from 'react-redux'
interface Props {
instance: Instance
@ -30,9 +29,7 @@ interface Props {
}
const AccountButton: React.FC<Props> = ({ instance, selected = false }) => {
const queryClient = useQueryClient()
const navigation = useNavigation()
const dispatch = useDispatch()
return (
<Button
@ -45,8 +42,7 @@ const AccountButton: React.FC<Props> = ({ instance, selected = false }) => {
onPress={() => {
haptics('Light')
analytics('switch_existing_press')
dispatch(updateInstanceActive(instance))
queryClient.clear()
initQuery({ instance, prefetch: { enabled: true } })
navigation.goBack()
}}
/>