Page MenuHomePhabricator

D3794.diff
No OneTemporary

D3794.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
@@ -102,6 +102,7 @@
+onChangeAccountPassword: (event: SyntheticEvent<HTMLInputElement>) => void,
+hasPermissionForTab: (thread: ThreadInfo, tab: TabType) => boolean,
+deleteThreadAction: () => Promise<LeaveThreadPayload>,
+ +onDelete: (event: SyntheticEvent<HTMLElement>) => void,
};
class ThreadSettingsModal extends React.PureComponent<Props> {
nameInput: ?HTMLInputElement;
@@ -189,7 +190,7 @@
if (this.props.currentTabType === 'delete') {
buttons = (
<Button
- onClick={this.onDelete}
+ onClick={this.props.onDelete}
variant="danger"
disabled={inputDisabled}
>
@@ -312,14 +313,6 @@
throw e;
}
}
-
- onDelete = (event: SyntheticEvent<HTMLElement>) => {
- event.preventDefault();
- this.props.dispatchActionPromise(
- deleteThreadActionTypes,
- this.props.deleteThreadAction(),
- );
- };
}
const deleteThreadLoadingStatusSelector = createLoadingStatusSelector(
@@ -472,6 +465,14 @@
}
}, [accountPassword, callDeleteThread, modalContext, threadInfo]);
+ const onDelete = React.useCallback(
+ (event: SyntheticEvent<HTMLElement>) => {
+ event.preventDefault();
+ dispatchActionPromise(deleteThreadActionTypes, deleteThreadAction());
+ },
+ [deleteThreadAction, dispatchActionPromise],
+ );
+
if (!threadInfo) {
return (
<Modal onClose={modalContext.clearModal} name="Invalid thread">
@@ -510,6 +511,7 @@
onChangeAccountPassword={onChangeAccountPassword}
hasPermissionForTab={hasPermissionForTab}
deleteThreadAction={deleteThreadAction}
+ onDelete={onDelete}
/>
);
},

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 8, 4:24 PM (20 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2444562
Default Alt Text
D3794.diff (1 KB)

Event Timeline