Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3353382
D3763.id11732.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
D3763.id11732.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
@@ -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
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 9:39 AM (21 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2574862
Default Alt Text
D3763.id11732.diff (2 KB)
Attached To
Mode
D3763: [web] Move `changeQueued` up from `ThreadSettingsModal` to `ConnectedThreadSettingsModal`
Attached
Detach File
Event Timeline
Log In to Comment