Page MenuHomePhabricator

D3767.id11576.diff
No OneTemporary

D3767.id11576.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
@@ -98,6 +98,7 @@
+setTab: (tabType: TabType) => void,
+onChangeName: (event: SyntheticEvent<HTMLInputElement>) => void,
+onChangeDescription: (event: SyntheticEvent<HTMLTextAreaElement>) => void,
+ +onChangeColor: (color: string) => void,
};
class ThreadSettingsModal extends React.PureComponent<Props> {
nameInput: ?HTMLInputElement;
@@ -176,7 +177,7 @@
threadDescriptionOnChange={this.props.onChangeDescription}
threadDescriptionDisabled={inputDisabled}
threadColorCurrentColor={this.possiblyChangedValue('color')}
- threadColorOnColorSelection={this.onChangeColor}
+ threadColorOnColorSelection={this.props.onChangeColor}
/>
);
} else if (this.props.currentTabType === 'privacy') {
@@ -292,14 +293,6 @@
this.accountPasswordInput = accountPasswordInput;
};
- onChangeColor = (color: string) => {
- const newValue = color !== this.props.threadInfo.color ? color : undefined;
- this.props.setQueuedChanges({
- ...this.props.queuedChanges,
- color: newValue,
- });
- };
-
onChangeThreadType = (event: SyntheticEvent<HTMLInputElement>) => {
const uiValue = assertThreadType(parseInt(event.currentTarget.value, 10));
const newValue =
@@ -449,6 +442,17 @@
[queuedChanges, threadInfo],
);
+ const onChangeColor = React.useCallback(
+ (color: string) => {
+ invariant(threadInfo, 'threadInfo should exist in onChangeColor');
+ setQueuedChanges({
+ ...queuedChanges,
+ color: color !== threadInfo.color ? color : undefined,
+ });
+ },
+ [queuedChanges, threadInfo],
+ );
+
if (!threadInfo) {
return (
<Modal onClose={modalContext.clearModal} name="Invalid thread">
@@ -483,6 +487,7 @@
setTab={setTab}
onChangeName={onChangeName}
onChangeDescription={onChangeDescription}
+ onChangeColor={onChangeColor}
/>
);
},

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 28, 5:40 AM (21 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2592947
Default Alt Text
D3767.id11576.diff (2 KB)

Event Timeline