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) => void, +onChangeDescription: (event: SyntheticEvent) => void, +onChangeColor: (color: string) => void, + +onChangeThreadType: (event: SyntheticEvent) => void, }; class ThreadSettingsModal extends React.PureComponent { nameInput: ?HTMLInputElement; @@ -183,7 +184,7 @@ mainContent = ( ); @@ -296,18 +297,6 @@ this.accountPasswordInput = accountPasswordInput; }; - onChangeThreadType = (event: SyntheticEvent) => { - 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) => { const target = event.currentTarget; this.props.setAccountPassword(target.value); @@ -458,6 +447,21 @@ [queuedChanges, threadInfo?.color], ); + const onChangeThreadType = React.useCallback( + (event: SyntheticEvent) => { + const uiValue = assertThreadType( + parseInt(event.currentTarget.value, 10), + ); + setQueuedChanges( + Object.freeze({ + ...queuedChanges, + type: uiValue !== threadInfo?.type ? uiValue : undefined, + }), + ); + }, + [queuedChanges, threadInfo?.type], + ); + if (!threadInfo) { return ( @@ -492,6 +496,7 @@ onChangeName={onChangeName} onChangeDescription={onChangeDescription} onChangeColor={onChangeColor} + onChangeThreadType={onChangeThreadType} /> ); },