Page MenuHomePhabricator

D3796.diff
No OneTemporary

D3796.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
@@ -104,6 +104,7 @@
+deleteThreadAction: () => Promise<LeaveThreadPayload>,
+onDelete: (event: SyntheticEvent<HTMLElement>) => void,
+changeThreadSettingsAction: () => Promise<ChangeThreadSettingsPayload>,
+ +onSubmit: (event: SyntheticEvent<HTMLElement>) => void,
};
class ThreadSettingsModal extends React.PureComponent<Props> {
nameInput: ?HTMLInputElement;
@@ -202,7 +203,7 @@
buttons = (
<Button
type="submit"
- onClick={this.onSubmit}
+ onClick={this.props.onSubmit}
disabled={inputDisabled || !this.props.changeQueued}
className={css.save_button}
>
@@ -287,14 +288,6 @@
accountPasswordInputRef = (accountPasswordInput: ?HTMLInputElement) => {
this.accountPasswordInput = accountPasswordInput;
};
-
- onSubmit = (event: SyntheticEvent<HTMLElement>) => {
- event.preventDefault();
- this.props.dispatchActionPromise(
- changeThreadSettingsActionTypes,
- this.props.changeThreadSettingsAction(),
- );
- };
}
const deleteThreadLoadingStatusSelector = createLoadingStatusSelector(
@@ -478,6 +471,17 @@
}
}, [callChangeThreadSettings, modalContext, queuedChanges, threadInfo]);
+ const onSubmit = React.useCallback(
+ (event: SyntheticEvent<HTMLElement>) => {
+ event.preventDefault();
+ dispatchActionPromise(
+ changeThreadSettingsActionTypes,
+ changeThreadSettingsAction(),
+ );
+ },
+ [changeThreadSettingsAction, dispatchActionPromise],
+ );
+
if (!threadInfo) {
return (
<Modal onClose={modalContext.clearModal} name="Invalid thread">
@@ -518,6 +522,7 @@
deleteThreadAction={deleteThreadAction}
onDelete={onDelete}
changeThreadSettingsAction={changeThreadSettingsAction}
+ onSubmit={onSubmit}
/>
);
},

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 8, 4:28 PM (20 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2444568
Default Alt Text
D3796.diff (2 KB)

Event Timeline