Skip to content

Commit cf79584

Browse files
authored
fix: better handle env variables and execution flags settings changes (#1410)
1 parent 50b18d9 commit cf79584

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/renderer/components/settings-execution.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,6 @@ export const ExecutionSettings = observer(
7777
}
7878
}
7979

80-
public componentDidUpdate() {
81-
const { appState } = this.props;
82-
83-
for (const type of Object.values(SettingItemType)) {
84-
const values = Object.values(this.state[type]);
85-
appState[type] = values.filter((v) => v !== '');
86-
}
87-
}
88-
8980
/**
9081
* Handles a change on whether or not the user data dir should be deleted
9182
* after a run.
@@ -122,12 +113,18 @@ export const ExecutionSettings = observer(
122113
) {
123114
const { name, value } = event.currentTarget;
124115

125-
this.setState((prevState) => ({
126-
[type]: {
127-
...prevState[type],
128-
[name]: value,
116+
this.setState(
117+
(prevState) => ({
118+
[type]: {
119+
...prevState[type],
120+
[name]: value,
121+
},
122+
}),
123+
() => {
124+
const values = Object.values(this.state[type]);
125+
this.props.appState[type] = values.filter((v) => v !== '');
129126
},
130-
}));
127+
);
131128
}
132129

133130
/**
@@ -169,7 +166,10 @@ export const ExecutionSettings = observer(
169166
delete updated[idx];
170167
}
171168

172-
this.setState({ [type]: updated });
169+
this.setState({ [type]: updated }, () => {
170+
const values = Object.values(this.state[type]);
171+
this.props.appState[type] = values.filter((v) => v !== '');
172+
});
173173
};
174174

175175
return (

0 commit comments

Comments
 (0)