Skip to content

Commit

Permalink
fix: 🐛 fetches latest personal details every time intead of cached va…
Browse files Browse the repository at this point in the history
  • Loading branch information
shaheer-deriv committed Mar 24, 2023
1 parent 5f5f791 commit ff497c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export const PersonalDetailsForm = ({
updateAccountStatus,
has_poa_address_mismatch,
is_language_changing,
fetchAccountSettings,
}) => {
const [is_loading, setIsLoading] = React.useState(true);

Expand Down Expand Up @@ -171,6 +172,7 @@ export const PersonalDetailsForm = ({
getSettings();
}
initializeFormValues();
return () => fetchAccountSettings();
}, [account_settings, is_eu, is_mf, is_social_signup]);

React.useEffect(() => {
Expand Down Expand Up @@ -1357,6 +1359,7 @@ PersonalDetailsForm.propTypes = {
updateAccountStatus: PropTypes.func,
has_poa_address_mismatch: PropTypes.bool,
is_language_changing: PropTypes.bool,
fetchAccountSettings: PropTypes.func,
};

export default connect(({ client, notifications, ui, common }) => ({
Expand All @@ -1382,4 +1385,5 @@ export default connect(({ client, notifications, ui, common }) => ({
updateAccountStatus: client.updateAccountStatus,
has_poa_address_mismatch: client.account_status.status?.includes('poa_address_mismatch'),
is_language_changing: common.is_language_changing,
fetchAccountSettings: client.fetchAccountSettings,
}))(withRouter(PersonalDetailsForm));
2 changes: 1 addition & 1 deletion packages/core/src/Stores/client-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -2336,7 +2336,7 @@ export default class ClientStore extends BaseStore {

fetchAccountSettings() {
return new Promise(resolve => {
WS.authorized.storage.getSettings().then(response => {
WS.authorized.getSettings().then(response => {
this.setAccountSettings(response.get_settings);
resolve(response);
});
Expand Down

0 comments on commit ff497c1

Please sign in to comment.