Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3348198
D3796.id11818.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D3796.id11818.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D3796: [web] Move `onSubmit` up from `ThreadSettingsModal` to `ConnectedThreadSettingsModal`
Attached
Detach File
Event Timeline
Log In to Comment