Page MenuHomePhabricator

D3765.id11574.diff
No OneTemporary

D3765.id11574.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
@@ -96,6 +96,7 @@
+namePlaceholder: string,
+changeQueued: boolean,
+setTab: (tabType: TabType) => void,
+ +onChangeName: (event: SyntheticEvent<HTMLInputElement>) => void,
};
class ThreadSettingsModal extends React.PureComponent<Props> {
nameInput: ?HTMLInputElement;
@@ -167,7 +168,7 @@
<ThreadSettingsGeneralTab
threadNameValue={firstLine(this.possiblyChangedValue('name'))}
threadNamePlaceholder={this.props.namePlaceholder}
- threadNameOnChange={this.onChangeName}
+ threadNameOnChange={this.props.onChangeName}
threadNameDisabled={inputDisabled}
threadNameInputRef={this.nameInputRef}
threadDescriptionValue={this.possiblyChangedValue('description')}
@@ -290,16 +291,6 @@
this.accountPasswordInput = accountPasswordInput;
};
- onChangeName = (event: SyntheticEvent<HTMLInputElement>) => {
- const target = event.currentTarget;
- const newValue =
- target.value !== this.props.threadInfo.name ? target.value : undefined;
- this.props.setQueuedChanges({
- ...this.props.queuedChanges,
- name: firstLine(newValue),
- });
- };
-
onChangeDescription = (event: SyntheticEvent<HTMLTextAreaElement>) => {
const target = event.currentTarget;
const newValue =
@@ -442,6 +433,20 @@
setCurrentTabType(tabType);
}, []);
+ const onChangeName = React.useCallback(
+ (event: SyntheticEvent<HTMLInputElement>) => {
+ invariant(threadInfo, 'threadInfo should exist in onChangeName');
+ const target = event.currentTarget;
+ setQueuedChanges({
+ ...queuedChanges,
+ name: firstLine(
+ target.value !== threadInfo.name ? target.value : undefined,
+ ),
+ });
+ },
+ [queuedChanges, threadInfo],
+ );
+
if (!threadInfo) {
return (
<Modal onClose={modalContext.clearModal} name="Invalid thread">
@@ -474,6 +479,7 @@
namePlaceholder={namePlaceholder}
changeQueued={changeQueued}
setTab={setTab}
+ onChangeName={onChangeName}
/>
);
},

File Metadata

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

Event Timeline