mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Properly clean and reset navigators
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { useNavigation } from '@react-navigation/native'
|
||||
import { StackActions, useFocusEffect, useNavigation } from '@react-navigation/native'
|
||||
import { useGlobalStorage } from '@utils/storage/actions'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
@ -8,8 +8,8 @@ const usePopToTop = () => {
|
||||
const navigation = useNavigation()
|
||||
const [accountActive] = useGlobalStorage.string('account.active')
|
||||
|
||||
return useEffect(() => {
|
||||
// navigation.dispatch(StackActions.popToTop())
|
||||
useEffect(() => {
|
||||
navigation.dispatch(StackActions.popToTop())
|
||||
}, [accountActive])
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,6 @@ const updateStatusProperty = ({
|
||||
if (!key) continue
|
||||
|
||||
queryClient.setQueryData<InfiniteData<TimelineData> | undefined>(key, old => {
|
||||
console.log('key', key)
|
||||
if (old) {
|
||||
let foundToot: Mastodon.Status | undefined = undefined
|
||||
old.pages = old.pages.map(page => {
|
||||
@ -42,7 +41,6 @@ const updateStatusProperty = ({
|
||||
|
||||
if (foundToot) {
|
||||
const toot = foundToot as Mastodon.Status
|
||||
console.log('updating', toot.id)
|
||||
enum MapPropertyToCount {
|
||||
favourited = 'favourites_count',
|
||||
reblogged = 'reblogs_count'
|
||||
@ -53,9 +51,7 @@ const updateStatusProperty = ({
|
||||
toot.poll = poll
|
||||
break
|
||||
default:
|
||||
console.log('11', toot[payload.type])
|
||||
toot[payload.type] = payload.to
|
||||
console.log('22', toot[payload.type])
|
||||
switch (payload.type) {
|
||||
case 'favourited':
|
||||
case 'reblogged':
|
||||
|
@ -212,6 +212,7 @@ export const generateAccountKey = ({
|
||||
export const setAccount = async (account: string) => {
|
||||
storage.account = new MMKV({ id: account })
|
||||
setGlobalStorage('account.active', account)
|
||||
await queryClient.resetQueries()
|
||||
queryClient.clear()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user