diff --git a/.gitignore b/.gitignore index 38505fd5f..fe467fd55 100644 --- a/.gitignore +++ b/.gitignore @@ -73,3 +73,6 @@ fastlane/Appfile # Apple signing and auth files that fastlane might download *.cer *.mobileprovision + +# VisualStudioCode # +.vscode \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index f4af73327..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "editor.codeActionsOnSave": { - "source.fixAll.eslint": true - }, - "editor.tabSize": 2, - "eslint.validate": ["javascript"] -} \ No newline at end of file diff --git a/src/components/App.js b/src/components/App.js index 831367fde..797f25741 100644 --- a/src/components/App.js +++ b/src/components/App.js @@ -61,10 +61,11 @@ const App = ( { children }: Props ): Node => { async function changeLanguageToLocale( locale ) { await i18next.changeLanguage( locale ); } + if ( !currentUser ) { return; } if ( currentUser?.locale ) { changeLanguageToLocale( currentUser.locale ); } - }, [currentUser?.locale] ); + }, [currentUser] ); // this children prop is here for the sake of testing with jest // normally we would never do this in code diff --git a/src/components/ObsEdit/DeleteObservationDialog.js b/src/components/ObsEdit/DeleteObservationDialog.js index 9fb776008..6db8061f9 100644 --- a/src/components/ObsEdit/DeleteObservationDialog.js +++ b/src/components/ObsEdit/DeleteObservationDialog.js @@ -27,13 +27,17 @@ const DeleteObservationDialog = ( { const navigation = useNavigation( ); const { uuid } = currentObservation; + const handleLocalDeletion = ( ) => { + deleteLocalObservation( uuid ); + hideDialog( ); + navigation.navigate( "ObsList" ); + }; + const deleteObservationMutation = useAuthenticatedMutation( ( params, optsWithAuth ) => deleteObservation( params, optsWithAuth ), { onSuccess: ( ) => { - deleteLocalObservation( uuid ); - hideDialog( ); - navigation.navigate( "ObsList" ); + handleLocalDeletion( ); } } ); @@ -47,7 +51,13 @@ const DeleteObservationDialog = ( {