Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3572596
D3765.id11737.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
D3765.id11737.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
@@ -95,6 +95,7 @@
+setQueuedChanges: SetState<ThreadChanges>,
+namePlaceholder: string,
+changeQueued: boolean,
+ +onChangeName: (event: SyntheticEvent<HTMLInputElement>) => void,
};
class ThreadSettingsModal extends React.PureComponent<Props> {
nameInput: ?HTMLInputElement;
@@ -166,7 +167,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')}
@@ -293,18 +294,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(
- Object.freeze({
- ...this.props.queuedChanges,
- name: firstLine(newValue),
- }),
- );
- };
-
onChangeDescription = (event: SyntheticEvent<HTMLTextAreaElement>) => {
const target = event.currentTarget;
const newValue =
@@ -448,6 +437,19 @@
[queuedChanges],
);
+ const onChangeName = React.useCallback(
+ (event: SyntheticEvent<HTMLInputElement>) => {
+ 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">
@@ -479,6 +481,7 @@
setQueuedChanges={setQueuedChanges}
namePlaceholder={namePlaceholder}
changeQueued={changeQueued}
+ onChangeName={onChangeName}
/>
);
},
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 29, 12:08 PM (8 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2732188
Default Alt Text
D3765.id11737.diff (2 KB)
Attached To
Mode
D3765: [web] Move `onChangeName` up from `ThreadSettingsModal` to `ConnectedThreadSettingsModal`
Attached
Detach File
Event Timeline
Log In to Comment