Page MenuHomePhabricator

D3766.diff
No OneTemporary

D3766.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,
+onChangeName: (event: SyntheticEvent<HTMLInputElement>) => void,
+ +onChangeDescription: (event: SyntheticEvent<HTMLTextAreaElement>) => void,
};
class ThreadSettingsModal extends React.PureComponent<Props> {
nameInput: ?HTMLInputElement;
@@ -171,7 +172,7 @@
threadNameDisabled={inputDisabled}
threadNameInputRef={this.nameInputRef}
threadDescriptionValue={this.possiblyChangedValue('description')}
- threadDescriptionOnChange={this.onChangeDescription}
+ threadDescriptionOnChange={this.props.onChangeDescription}
threadDescriptionDisabled={inputDisabled}
threadColorCurrentColor={this.possiblyChangedValue('color')}
threadColorOnColorSelection={this.onChangeColor}
@@ -294,20 +295,6 @@
this.accountPasswordInput = accountPasswordInput;
};
- onChangeDescription = (event: SyntheticEvent<HTMLTextAreaElement>) => {
- const target = event.currentTarget;
- const newValue =
- target.value !== this.props.threadInfo.description
- ? target.value
- : undefined;
- this.props.setQueuedChanges(
- Object.freeze({
- ...this.props.queuedChanges,
- description: newValue,
- }),
- );
- };
-
onChangeColor = (color: string) => {
const newValue = color !== this.props.threadInfo.color ? color : undefined;
this.props.setQueuedChanges(
@@ -452,6 +439,18 @@
[queuedChanges, threadInfo?.name],
);
+ const onChangeDescription = React.useCallback(
+ (event: SyntheticEvent<HTMLTextAreaElement>) => {
+ const target = event.currentTarget;
+ setQueuedChanges({
+ ...queuedChanges,
+ description:
+ target.value !== threadInfo?.description ? target.value : undefined,
+ });
+ },
+ [queuedChanges, threadInfo?.description],
+ );
+
if (!threadInfo) {
return (
<Modal onClose={modalContext.clearModal} name="Invalid thread">
@@ -484,6 +483,7 @@
namePlaceholder={namePlaceholder}
changeQueued={changeQueued}
onChangeName={onChangeName}
+ onChangeDescription={onChangeDescription}
/>
);
},

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 8, 4:19 PM (21 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2444556
Default Alt Text
D3766.diff (2 KB)

Event Timeline