Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33006677
D3763.1768364001.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D3763.1768364001.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
@@ -446,6 +434,14 @@
return robotextName(threadInfo, viewerID, userInfos);
}, [threadInfo, userInfos, viewerID]);
+ const changeQueued: boolean = React.useMemo(
+ () =>
+ Object.entries(queuedChanges).filter(
+ entry => entry[1] !== null && entry[1] !== undefined,
+ ).length > 0,
+ [queuedChanges],
+ );
+
if (!threadInfo) {
return (
<Modal onClose={modalContext.clearModal} name="Invalid thread">
@@ -476,6 +472,7 @@
queuedChanges={queuedChanges}
setQueuedChanges={setQueuedChanges}
namePlaceholder={namePlaceholder}
+ changeQueued={changeQueued}
/>
);
},
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 14, 4:13 AM (9 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5930248
Default Alt Text
D3763.1768364001.diff (2 KB)
Attached To
Mode
D3763: [web] Move `changeQueued` up from `ThreadSettingsModal` to `ConnectedThreadSettingsModal`
Attached
Detach File
Event Timeline
Log In to Comment