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 @@ -99,6 +99,7 @@ +onChangeName: (event: SyntheticEvent) => void, +onChangeDescription: (event: SyntheticEvent) => void, +onChangeColor: (color: string) => void, + +onChangeThreadType: (event: SyntheticEvent) => void, }; class ThreadSettingsModal extends React.PureComponent { nameInput: ?HTMLInputElement; @@ -184,7 +185,7 @@ mainContent = ( ); @@ -293,16 +294,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({ - ...this.props.queuedChanges, - type: newValue, - }); - }; - onChangeAccountPassword = (event: SyntheticEvent) => { const target = event.currentTarget; this.props.setAccountPassword(target.value); @@ -453,6 +444,20 @@ [queuedChanges, threadInfo], ); + const onChangeThreadType = React.useCallback( + (event: SyntheticEvent) => { + invariant(threadInfo, 'threadInfo should exist in onChangeThreadType'); + const uiValue = assertThreadType( + parseInt(event.currentTarget.value, 10), + ); + setQueuedChanges({ + ...queuedChanges, + type: uiValue !== threadInfo.type ? uiValue : undefined, + }); + }, + [queuedChanges, threadInfo], + ); + if (!threadInfo) { return ( @@ -488,6 +493,7 @@ onChangeName={onChangeName} onChangeDescription={onChangeDescription} onChangeColor={onChangeColor} + onChangeThreadType={onChangeThreadType} /> ); },