Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3377436
D3767.id11576.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
D3767.id11576.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
@@ -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
Details
Attached
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)
Attached To
Mode
D3767: [web] Move `onChangeColor` up from `ThreadSettingsModal` to `ConnectedThreadSettingsModal`
Attached
Detach File
Event Timeline
Log In to Comment