Page MenuHomePhabricator

D3768.id11750.diff
No OneTemporary

D3768.id11750.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 @@
+onChangeName: (event: SyntheticEvent<HTMLInputElement>) => void,
+onChangeDescription: (event: SyntheticEvent<HTMLTextAreaElement>) => void,
+onChangeColor: (color: string) => void,
+ +onChangeThreadType: (event: SyntheticEvent<HTMLInputElement>) => void,
};
class ThreadSettingsModal extends React.PureComponent<Props> {
nameInput: ?HTMLInputElement;
@@ -183,7 +184,7 @@
mainContent = (
<ThreadSettingsPrivacyTab
possiblyChangedThreadType={this.possiblyChangedValue('type')}
- onChangeThreadType={this.onChangeThreadType}
+ onChangeThreadType={this.props.onChangeThreadType}
inputDisabled={inputDisabled}
/>
);
@@ -296,18 +297,6 @@
this.accountPasswordInput = accountPasswordInput;
};
- onChangeThreadType = (event: SyntheticEvent<HTMLInputElement>) => {
- const uiValue = assertThreadType(parseInt(event.currentTarget.value, 10));
- const newValue =
- uiValue !== this.props.threadInfo.type ? uiValue : undefined;
- this.props.setQueuedChanges(
- Object.freeze({
- ...this.props.queuedChanges,
- type: newValue,
- }),
- );
- };
-
onChangeAccountPassword = (event: SyntheticEvent<HTMLInputElement>) => {
const target = event.currentTarget;
this.props.setAccountPassword(target.value);
@@ -458,6 +447,21 @@
[queuedChanges, threadInfo?.color],
);
+ const onChangeThreadType = React.useCallback(
+ (event: SyntheticEvent<HTMLInputElement>) => {
+ const uiValue = assertThreadType(
+ parseInt(event.currentTarget.value, 10),
+ );
+ setQueuedChanges(
+ Object.freeze({
+ ...queuedChanges,
+ type: uiValue !== threadInfo?.type ? uiValue : undefined,
+ }),
+ );
+ },
+ [queuedChanges, threadInfo?.type],
+ );
+
if (!threadInfo) {
return (
<Modal onClose={modalContext.clearModal} name="Invalid thread">
@@ -492,6 +496,7 @@
onChangeName={onChangeName}
onChangeDescription={onChangeDescription}
onChangeColor={onChangeColor}
+ onChangeThreadType={onChangeThreadType}
/>
);
},

File Metadata

Mime Type
text/plain
Expires
Thu, Sep 19, 3:01 PM (6 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2139906
Default Alt Text
D3768.id11750.diff (2 KB)

Event Timeline