File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
src/shared/components/Settings/Preferences/Email Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,13 @@ const programs = [
7272
7373export default class EmailPreferences extends React . Component {
7474 saveEmailPreferences = debounce ( ( id , checked ) => {
75+ // update local state
76+ const { emailPreferences, status } = this . state ;
77+ emailPreferences [ id ] = checked ;
78+ this . setState ( {
79+ emailPreferences,
80+ status : checked ? 'subscribed' : status ,
81+ } ) ;
7582 const { email, saveEmailPreferences } = this . props ;
7683 saveEmailPreferences ( email , id , checked ) ;
7784 } , SAVE_DELAY ) ;
@@ -108,13 +115,6 @@ export default class EmailPreferences extends React.Component {
108115
109116 onChange ( id , checked ) {
110117 // document.querySelectorAll(`#pre-onoffswitch-${id}`).forEach((el) => { el.checked = checked; }); // eslint-disable-line no-param-reassign
111- // update local state
112- const { emailPreferences, status } = this . state ;
113- emailPreferences [ id ] = checked ;
114- this . setState ( {
115- emailPreferences,
116- status : checked ? 'subscribed' : status ,
117- } ) ;
118118 // update remote state
119119 this . saveEmailPreferences ( id , checked ) ;
120120 }
You can’t perform that action at this time.
0 commit comments