mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-23 22:18:36 -05:00
Check for current user before refetch notifications
This commit is contained in:
@@ -45,17 +45,19 @@ const NotificationsContainer = ( {
|
||||
|
||||
useEffect( ( ) => {
|
||||
navigation.addListener( "focus", ( ) => {
|
||||
if ( isConnected ) {
|
||||
if ( isConnected && currentUser ) {
|
||||
refetch();
|
||||
}
|
||||
} );
|
||||
}, [isConnected, navigation, refetch] );
|
||||
}, [isConnected, currentUser, navigation, refetch] );
|
||||
|
||||
const onRefresh = async () => {
|
||||
setRefreshing( true );
|
||||
await refetch();
|
||||
if ( typeof ( onRefreshProp ) === "function" ) onRefreshProp( );
|
||||
setRefreshing( false );
|
||||
if ( currentUser ) {
|
||||
setRefreshing( true );
|
||||
await refetch();
|
||||
if ( typeof ( onRefreshProp ) === "function" ) onRefreshProp( );
|
||||
setRefreshing( false );
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user