Page MenuHomePhabricator

D3763.diff
No OneTemporary

D3763.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
@@ -2,7 +2,6 @@
import classNames from 'classnames';
import invariant from 'invariant';
-import _pickBy from 'lodash/fp/pickBy';
import * as React from 'react';
import {
@@ -95,6 +94,7 @@
+queuedChanges: ThreadChanges,
+setQueuedChanges: SetState<ThreadChanges>,
+namePlaceholder: string,
+ +changeQueued: boolean,
};
class ThreadSettingsModal extends React.PureComponent<Props> {
nameInput: ?HTMLInputElement;
@@ -154,18 +154,6 @@
: this.props.threadInfo[key];
}
- changeQueued() {
- return (
- Object.keys(
- _pickBy(
- value => value !== null && value !== undefined,
- // the lodash/fp libdef coerces the returned object's properties to the
- // same type, which means it only works for object-as-maps $FlowFixMe
- )(this.props.queuedChanges),
- ).length > 0
- );
- }
-
render() {
const { threadInfo } = this.props;
const inputDisabled =
@@ -223,7 +211,7 @@
<Button
type="submit"
onClick={this.onSubmit}
- disabled={inputDisabled || !this.changeQueued()}
+ disabled={inputDisabled || !this.props.changeQueued}
className={css.save_button}
>
Save
@@ -454,6 +442,12 @@
return robotextName(threadInfo, viewerID, userInfos);
}, [threadInfo, userInfos, viewerID]);
+ const changeQueued: boolean = React.useMemo(
+ () =>
+ Object.values(queuedChanges).some(v => v !== null && v !== undefined),
+ [queuedChanges],
+ );
+
if (!threadInfo) {
return (
<Modal onClose={modalContext.clearModal} name="Invalid thread">
@@ -484,6 +478,7 @@
queuedChanges={queuedChanges}
setQueuedChanges={setQueuedChanges}
namePlaceholder={namePlaceholder}
+ changeQueued={changeQueued}
/>
);
},

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 8, 5:31 PM (21 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2444796
Default Alt Text
D3763.diff (2 KB)

Event Timeline