Skip to content

Commit

Permalink
fix: clean errorModel state when screen unmounts
Browse files Browse the repository at this point in the history
  • Loading branch information
alexruzenhack committed Oct 19, 2023
1 parent b5b8424 commit 899e06c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/reducers/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,7 @@ export const onNetworkSettingsUpdate = (state) => ({
export const onNetworkSettingsUpdateSucess = (state, { payload }) => ({
...state,
networkSettings: payload,
networkSettingsStatus: NETWORKSETTINGS_STATUS.LOADING,
});

/**
Expand Down
10 changes: 8 additions & 2 deletions src/screens/NetworkSettings/CustomNetworkSettingsScreen.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useEffect, useState } from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { View, Text, StyleSheet, Image } from 'react-native';
import { useDispatch, useSelector } from 'react-redux';
import { t } from 'ttag';
import { isEmpty } from 'lodash';
import { networkSettingsUpdate, networkSettingsUpdateReady } from '../../actions';
import { networkSettingsUpdate, networkSettingsUpdateErrors, networkSettingsUpdateReady } from '../../actions';
import FeedbackModal from '../../components/FeedbackModal';
import HathorHeader from '../../components/HathorHeader';
import NewHathorButton from '../../components/NewHathorButton';
Expand Down Expand Up @@ -171,6 +171,12 @@ export const CustomNetworkSettingsScreen = ({ navigation }) => {
});
}, [networkSettingsErrors]);

useEffect(() => {
return function cleanUp() {
dispatch(networkSettingsUpdateErrors({}));
};
}, []);

return (
<View style={styles.container}>
<HathorHeader
Expand Down

0 comments on commit 899e06c

Please sign in to comment.