Page MenuHomePhabricator

D3756.diff
No OneTemporary

D3756.diff

diff --git a/web/modals/threads/thread-settings-modal.react.js b/web/modals/threads/thread-settings-modal.react.js
--- a/web/modals/threads/thread-settings-modal.react.js
+++ b/web/modals/threads/thread-settings-modal.react.js
@@ -14,6 +14,7 @@
import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';
import { threadInfoSelector } from 'lib/selectors/thread-selectors';
import { threadHasPermission, robotextName } from 'lib/shared/thread-utils';
+import { type SetState } from 'lib/types/hook-types.js';
import {
type ThreadInfo,
threadTypes,
@@ -85,10 +86,11 @@
update: UpdateThreadRequest,
) => Promise<ChangeThreadSettingsPayload>,
+onClose: () => void,
+ +errorMessage: string,
+ +setErrorMessage: SetState<string>,
};
type State = {
+queuedChanges: ThreadChanges,
- +errorMessage: string,
+accountPassword: string,
+currentTabType: TabType,
};
@@ -100,7 +102,6 @@
super(props);
this.state = {
queuedChanges: Object.freeze({}),
- errorMessage: '',
accountPassword: '',
currentTabType: 'general',
};
@@ -294,7 +295,7 @@
<div className={css.form_footer}>
{buttons}
<div className={css.modal_form_error}>
- {this.state.errorMessage}
+ {this.props.errorMessage}
</div>
</div>
</form>
@@ -389,12 +390,12 @@
this.props.onClose();
return response;
} catch (e) {
+ this.props.setErrorMessage('unknown error');
this.setState(
prevState => ({
...prevState,
queuedChanges: Object.freeze({}),
accountPassword: '',
- errorMessage: 'unknown error',
currentTabType: 'general',
}),
() => {
@@ -427,10 +428,10 @@
e.message === 'invalid_credentials'
? 'wrong password'
: 'unknown error';
+ this.props.setErrorMessage(errorMessage);
this.setState(
{
accountPassword: '',
- errorMessage: errorMessage,
},
() => {
invariant(
@@ -470,6 +471,7 @@
state => threadInfoSelector(state)[props.threadID],
);
const modalContext = useModalContext();
+ const [errorMessage, setErrorMessage] = React.useState('');
if (!threadInfo) {
return (
@@ -492,6 +494,8 @@
changeThreadSettings={callChangeThreadSettings}
dispatchActionPromise={dispatchActionPromise}
onClose={modalContext.clearModal}
+ errorMessage={errorMessage}
+ setErrorMessage={setErrorMessage}
/>
);
},

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 8, 7:03 PM (20 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2444967
Default Alt Text
D3756.diff (2 KB)

Event Timeline