Page MenuHomePhabricator

D3796.id11818.diff
No OneTemporary

D3796.id11818.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
Sat, Nov 23, 2:01 PM (5 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2571072
Default Alt Text
D3796.id11818.diff (2 KB)

Event Timeline