Resolve linter issues

This commit is contained in:
Chi Vinh Le
2018-06-05 04:28:54 +02:00
parent d9a1d739dc
commit ccff6ed63b
148 changed files with 1171 additions and 265 deletions
@@ -19,7 +19,9 @@ class BanUserDialog extends React.Component {
}
handleMessageChange = e => {
const { target: { value: message } } = e;
const {
target: { value: message },
} = e;
this.setState({ message });
};
@@ -27,7 +27,9 @@ class KarmaTooltip extends React.Component {
};
render() {
const { thresholds: { unreliable } } = this.props;
const {
thresholds: { unreliable },
} = this.props;
const { menuVisible } = this.state;
return (
@@ -68,6 +70,7 @@ class KarmaTooltip extends React.Component {
className={styles.link}
href={t('user_detail.karma_docs_link')}
target="_blank"
rel="noopener noreferrer"
>
{t('user_detail.learn_more')}
</a>
@@ -159,7 +159,7 @@ class UserDetail extends React.Component {
} = this.props;
// if totalComments is 0, you're dividing by zero
let rejectedPercent = rejectedComments / totalComments * 100;
let rejectedPercent = (rejectedComments / totalComments) * 100;
if (rejectedPercent === Infinity || isNaN(rejectedPercent)) {
rejectedPercent = 0;
@@ -114,6 +114,7 @@ class UserDetailComment extends React.Component {
className={styles.external}
href={`${comment.asset.url}?commentId=${comment.id}`}
target="_blank"
rel="noopener noreferrer"
>
<Icon name="open_in_new" /> {t('comment.view_context')}
</a>
@@ -10,7 +10,10 @@ import ApproveButton from './ApproveButton';
const UserDetailCommentList = props => {
const {
root,
root: { user, comments: { nodes, hasNextPage } },
root: {
user,
comments: { nodes, hasNextPage },
},
acceptComment,
rejectComment,
selectedCommentIds,
@@ -77,7 +77,10 @@ const mapDispatchToProps = dispatch => ({
});
export default compose(
connect(mapStateToProps, mapDispatchToProps),
connect(
mapStateToProps,
mapDispatchToProps
),
withBanUser,
withSetCommentStatus
)(BanUserDialogContainer);
+4 -1
View File
@@ -81,4 +81,7 @@ const mapDispatchToProps = dispatch =>
dispatch
);
export default connect(mapStateToProps, mapDispatchToProps)(LayoutContainer);
export default connect(
mapStateToProps,
mapDispatchToProps
)(LayoutContainer);
@@ -83,7 +83,10 @@ const mapDispatchToProps = dispatch => ({
});
export default compose(
connect(mapStateToProps, mapDispatchToProps),
connect(
mapStateToProps,
mapDispatchToProps
),
withRejectUsername,
withPostFlag({ notifyOnError: false })
)(RejectUsernameDialogContainer);
+4 -1
View File
@@ -55,4 +55,7 @@ SignInContainer.propTypes = {
requireRecaptcha: PropTypes.bool.isRequired,
};
export default compose(withSignIn, withPopupAuthHandler)(SignInContainer);
export default compose(
withSignIn,
withPopupAuthHandler
)(SignInContainer);
@@ -86,7 +86,10 @@ const mapDispatchToProps = dispatch => ({
});
export default compose(
connect(mapStateToProps, mapDispatchToProps),
connect(
mapStateToProps,
mapDispatchToProps
),
withSuspendUser,
withSetCommentStatus,
withOrganizationName
@@ -294,7 +294,10 @@ const mapDispatchToProps = dispatch => ({
});
export default compose(
connect(mapStateToProps, mapDispatchToProps),
connect(
mapStateToProps,
mapDispatchToProps
),
withUserDetailQuery,
withSetCommentStatus,
withUnbanUser,
+20 -4
View File
@@ -66,7 +66,11 @@ export default {
});
},
}),
SuspendUser: ({ variables: { input: { id, until } } }) => ({
SuspendUser: ({
variables: {
input: { id, until },
},
}) => ({
update: proxy => {
const fragmentId = `User_${id}`;
@@ -92,7 +96,11 @@ export default {
});
},
}),
UnsuspendUser: ({ variables: { input: { id } } }) => ({
UnsuspendUser: ({
variables: {
input: { id },
},
}) => ({
update: proxy => {
const fragmentId = `User_${id}`;
const data = proxy.readFragment({
@@ -117,7 +125,11 @@ export default {
});
},
}),
BanUser: ({ variables: { input: { id } } }) => ({
BanUser: ({
variables: {
input: { id },
},
}) => ({
update: proxy => {
const fragmentId = `User_${id}`;
const data = proxy.readFragment({
@@ -142,7 +154,11 @@ export default {
});
},
}),
UnbanUser: ({ variables: { input: { id } } }) => ({
UnbanUser: ({
variables: {
input: { id },
},
}) => ({
update: proxy => {
const fragmentId = `User_${id}`;
const data = proxy.readFragment({
@@ -46,7 +46,11 @@ class FlaggedAccountsContainer extends Component {
document: USERNAME_FLAGGED_SUBSCRIPTION,
updateQuery: (
prev,
{ subscriptionData: { data: { usernameFlagged: user } } }
{
subscriptionData: {
data: { usernameFlagged: user },
},
}
) => {
return handleFlaggedAccountsChange(prev, user, () => {
const msg = t(
@@ -62,7 +66,11 @@ class FlaggedAccountsContainer extends Component {
document: USERNAME_APPROVED_SUBSCRIPTION,
updateQuery: (
prev,
{ subscriptionData: { data: { usernameApproved: user } } }
{
subscriptionData: {
data: { usernameApproved: user },
},
}
) => {
return handleFlaggedAccountsChange(prev, user, () => {
const msg = t(
@@ -78,7 +86,11 @@ class FlaggedAccountsContainer extends Component {
document: USERNAME_REJECTED_SUBSCRIPTION,
updateQuery: (
prev,
{ subscriptionData: { data: { usernameRejected: user } } }
{
subscriptionData: {
data: { usernameRejected: user },
},
}
) => {
return handleFlaggedAccountsChange(prev, user, () => {
const msg = t(
@@ -96,7 +108,9 @@ class FlaggedAccountsContainer extends Component {
prev,
{
subscriptionData: {
data: { usernameChanged: { previousUsername, user } },
data: {
usernameChanged: { previousUsername, user },
},
},
}
) => {
@@ -297,7 +311,10 @@ const mapDispatchToProps = dispatch =>
);
export default compose(
connect(null, mapDispatchToProps),
connect(
null,
mapDispatchToProps
),
withApproveUsername,
withQuery(
gql`
@@ -15,7 +15,11 @@ class IndicatorContainer extends Component {
document: USERNAME_FLAGGED_SUBSCRIPTION,
updateQuery: (
prev,
{ subscriptionData: { data: { usernameFlagged: user } } }
{
subscriptionData: {
data: { usernameFlagged: user },
},
}
) => {
return handleIndicatorChange(prev, user);
},
@@ -24,7 +28,11 @@ class IndicatorContainer extends Component {
document: USERNAME_APPROVED_SUBSCRIPTION,
updateQuery: (
prev,
{ subscriptionData: { data: { usernameApproved: user } } }
{
subscriptionData: {
data: { usernameApproved: user },
},
}
) => {
return handleIndicatorChange(prev, user);
},
@@ -33,7 +41,11 @@ class IndicatorContainer extends Component {
document: USERNAME_REJECTED_SUBSCRIPTION,
updateQuery: (
prev,
{ subscriptionData: { data: { usernameRejected: user } } }
{
subscriptionData: {
data: { usernameRejected: user },
},
}
) => {
return handleIndicatorChange(prev, user);
},
@@ -42,7 +54,13 @@ class IndicatorContainer extends Component {
document: USERNAME_CHANGED_SUBSCRIPTION,
updateQuery: (
prev,
{ subscriptionData: { data: { usernameChanged: { user } } } }
{
subscriptionData: {
data: {
usernameChanged: { user },
},
},
}
) => {
return handleIndicatorChange(prev, user);
},
@@ -200,7 +200,10 @@ const SEARCH_QUERY = gql`
`;
export default compose(
connect(null, mapDispatchToProps),
connect(
null,
mapDispatchToProps
),
withSetUserRole,
withUnsuspendUser,
withUnbanUser,
@@ -19,6 +19,9 @@ const mapDispatchToProps = dispatch =>
);
export default compose(
connect(mapStateToProps, mapDispatchToProps),
connect(
mapStateToProps,
mapDispatchToProps
),
withRejectUsername
)(RejectUsernameDialog);
@@ -174,7 +174,10 @@ const mapDispatchToProps = dispatch =>
export default compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps),
connect(
mapStateToProps,
mapDispatchToProps
),
withUpdateSettings,
withConfigureQuery,
withMergedSettings('root.settings', 'pending', 'mergedSettings')
@@ -42,7 +42,10 @@ export default compose(
}
`,
}),
connect(mapStateToProps, mapDispatchToProps),
connect(
mapStateToProps,
mapDispatchToProps
),
mapProps(({ root, settings, updatePending, errors, ...rest }) => ({
slotPassthrough: {
root,
@@ -37,7 +37,10 @@ export default compose(
}
`,
}),
connect(mapStateToProps, mapDispatchToProps),
connect(
mapStateToProps,
mapDispatchToProps
),
mapProps(({ root, settings, updatePending, errors, ...rest }) => ({
slotPassthrough: {
root,
@@ -45,7 +45,10 @@ export default compose(
}
`,
}),
connect(mapStateToProps, mapDispatchToProps),
connect(
mapStateToProps,
mapDispatchToProps
),
mapProps(({ root, settings, updatePending, errors, ...rest }) => ({
slotPassthrough: {
root,
@@ -39,7 +39,10 @@ export default compose(
}
`,
}),
connect(mapStateToProps, mapDispatchToProps),
connect(
mapStateToProps,
mapDispatchToProps
),
mapProps(({ root, settings, updatePending, errors, ...rest }) => ({
slotPassthrough: {
root,
@@ -83,4 +83,7 @@ const mapDispatchToProps = dispatch =>
dispatch
);
export default connect(mapStateToProps, mapDispatchToProps)(InstallContainer);
export default connect(
mapStateToProps,
mapDispatchToProps
)(InstallContainer);
@@ -170,6 +170,7 @@ class Comment extends React.Component {
className={styles.external}
href={`${comment.asset.url}?commentId=${comment.id}`}
target="_blank"
rel="noopener noreferrer"
>
<Icon name="open_in_new" /> {t('comment.view_context')}
</a>
@@ -5,7 +5,10 @@ import { Button, Spinner, Icon } from 'coral-ui';
import Story from './Story';
const StorySearch = props => {
const { root: { assets }, data: { loading } } = props;
const {
root: { assets },
data: { loading },
} = props;
if (!props.moderation.storySearchVisible) {
return null;
@@ -22,7 +22,11 @@ class IndicatorContainer extends Component {
document: COMMENT_ADDED_SUBSCRIPTION,
updateQuery: (
prev,
{ subscriptionData: { data: { commentAdded: comment } } }
{
subscriptionData: {
data: { commentAdded: comment },
},
}
) => {
return this.handleCommentChange(prev, comment);
},
@@ -31,7 +35,11 @@ class IndicatorContainer extends Component {
document: COMMENT_FLAGGED_SUBSCRIPTION,
updateQuery: (
prev,
{ subscriptionData: { data: { commentFlagged: comment } } }
{
subscriptionData: {
data: { commentFlagged: comment },
},
}
) => {
return this.handleCommentChange(prev, comment);
},
@@ -40,7 +48,11 @@ class IndicatorContainer extends Component {
document: COMMENT_EDITED_SUBSCRIPTION,
updateQuery: (
prev,
{ subscriptionData: { data: { commentEdited: comment } } }
{
subscriptionData: {
data: { commentEdited: comment },
},
}
) => {
return this.handleCommentChange(prev, comment);
},
@@ -49,7 +61,11 @@ class IndicatorContainer extends Component {
document: COMMENT_ACCEPTED_SUBSCRIPTION,
updateQuery: (
prev,
{ subscriptionData: { data: { commentAccepted: comment } } }
{
subscriptionData: {
data: { commentAccepted: comment },
},
}
) => {
return this.handleCommentChange(prev, comment);
},
@@ -58,7 +74,11 @@ class IndicatorContainer extends Component {
document: COMMENT_REJECTED_SUBSCRIPTION,
updateQuery: (
prev,
{ subscriptionData: { data: { commentRejected: comment } } }
{
subscriptionData: {
data: { commentRejected: comment },
},
}
) => {
return this.handleCommentChange(prev, comment);
},
@@ -67,7 +87,11 @@ class IndicatorContainer extends Component {
document: COMMENT_RESET_SUBSCRIPTION,
updateQuery: (
prev,
{ subscriptionData: { data: { commentReset: comment } } }
{
subscriptionData: {
data: { commentReset: comment },
},
}
) => {
return this.handleCommentChange(prev, comment);
},
@@ -71,7 +71,9 @@ class ModerationContainer extends Component {
};
get activeTab() {
const { root: { asset, settings } } = this.props;
const {
root: { asset, settings },
} = this.props;
const id = getAssetId(this.props);
const tab = getTab(this.props);
@@ -94,7 +96,11 @@ class ModerationContainer extends Component {
variables,
updateQuery: (
prev,
{ subscriptionData: { data: { commentAdded: comment } } }
{
subscriptionData: {
data: { commentAdded: comment },
},
}
) => {
return this.handleCommentChange(prev, comment);
},
@@ -104,7 +110,11 @@ class ModerationContainer extends Component {
variables,
updateQuery: (
prev,
{ subscriptionData: { data: { commentAccepted: comment } } }
{
subscriptionData: {
data: { commentAccepted: comment },
},
}
) => {
const user =
comment.status_history[comment.status_history.length - 1]
@@ -125,7 +135,11 @@ class ModerationContainer extends Component {
variables,
updateQuery: (
prev,
{ subscriptionData: { data: { commentRejected: comment } } }
{
subscriptionData: {
data: { commentRejected: comment },
},
}
) => {
const user =
comment.status_history[comment.status_history.length - 1]
@@ -146,7 +160,11 @@ class ModerationContainer extends Component {
variables,
updateQuery: (
prev,
{ subscriptionData: { data: { commentReset: comment } } }
{
subscriptionData: {
data: { commentReset: comment },
},
}
) => {
const user =
comment.status_history[comment.status_history.length - 1]
@@ -167,7 +185,11 @@ class ModerationContainer extends Component {
variables,
updateQuery: (
prev,
{ subscriptionData: { data: { commentEdited: comment } } }
{
subscriptionData: {
data: { commentEdited: comment },
},
}
) => {
return this.handleCommentChange(prev, comment);
},
@@ -177,7 +199,11 @@ class ModerationContainer extends Component {
variables,
updateQuery: (
prev,
{ subscriptionData: { data: { commentFlagged: comment } } }
{
subscriptionData: {
data: { commentFlagged: comment },
},
}
) => {
return this.handleCommentChange(prev, comment);
},
@@ -289,7 +315,11 @@ class ModerationContainer extends Component {
};
render() {
const { root, root: { asset, settings }, data } = this.props;
const {
root,
root: { asset, settings },
data,
} = this.props;
const assetId = getAssetId(this.props);
if (assetId) {
@@ -546,7 +576,10 @@ const mapDispatchToProps = dispatch => ({
export default compose(
withQueueConfig(baseQueueConfig),
connect(mapStateToProps, mapDispatchToProps),
connect(
mapStateToProps,
mapDispatchToProps
),
withSetCommentStatus,
withModQueueQuery
)(ModerationContainer);
@@ -112,4 +112,7 @@ export const withAssetSearchQuery = withQuery(
}
);
export default compose(withRouter, withAssetSearchQuery)(StorySearchContainer);
export default compose(
withRouter,
withAssetSearchQuery
)(StorySearchContainer);
@@ -113,4 +113,7 @@ StoriesContainer.propTypes = {
updateAssetState: PropTypes.func.isRequired,
};
export default connect(mapStateToProps, mapDispatchToProps)(StoriesContainer);
export default connect(
mapStateToProps,
mapDispatchToProps
)(StoriesContainer);
@@ -41,7 +41,13 @@ class EmbedContainer extends React.Component {
document: USER_BANNED_SUBSCRIPTION,
updateQuery: (
_,
{ subscriptionData: { data: { userBanned: { state } } } }
{
subscriptionData: {
data: {
userBanned: { state },
},
},
}
) => {
notify('info', t('your_account_has_been_banned'));
props.updateStatus(state.status);
@@ -51,7 +57,13 @@ class EmbedContainer extends React.Component {
document: USER_SUSPENDED_SUBSCRIPTION,
updateQuery: (
_,
{ subscriptionData: { data: { userSuspended: { state } } } }
{
subscriptionData: {
data: {
userSuspended: { state },
},
},
}
) => {
notify('info', t('your_account_has_been_suspended'));
props.updateStatus(state.status);
@@ -61,7 +73,13 @@ class EmbedContainer extends React.Component {
document: USERNAME_REJECTED_SUBSCRIPTION,
updateQuery: (
_,
{ subscriptionData: { data: { usernameRejected: { state } } } }
{
subscriptionData: {
data: {
usernameRejected: { state },
},
},
}
) => {
notify('info', t('your_username_has_been_rejected'));
props.updateStatus(state.status);
@@ -324,7 +342,10 @@ const mapDispatchToProps = dispatch =>
export default compose(
withPopupAuthHandler,
connect(mapStateToProps, mapDispatchToProps),
connect(
mapStateToProps,
mapDispatchToProps
),
branch(props => !props.checkedInitialLogin, renderComponent(Spinner)),
withEmbedQuery
)(EmbedContainer);
+24 -4
View File
@@ -126,7 +126,9 @@ export default {
},
mutations: {
PostComment: ({
variables: { input: { asset_id, body, parent_id, tags = [] } },
variables: {
input: { asset_id, body, parent_id, tags = [] },
},
state: { auth },
}) => ({
optimisticResponse: {
@@ -193,7 +195,13 @@ export default {
updateQueries: {
CoralEmbedStream_Embed: (
prev,
{ mutationResult: { data: { createComment: { comment } } } }
{
mutationResult: {
data: {
createComment: { comment },
},
},
}
) => {
if (
(![ADMIN, MODERATOR].includes(prev.me.role) &&
@@ -208,7 +216,13 @@ export default {
},
CoralEmbedStream_Profile: (
prev,
{ mutationResult: { data: { createComment: { comment } } } }
{
mutationResult: {
data: {
createComment: { comment },
},
},
}
) => {
return update(prev, {
me: {
@@ -224,7 +238,13 @@ export default {
updateQueries: {
CoralEmbedStream_Embed: (
prev,
{ mutationResult: { data: { editComment: { comment } } } }
{
mutationResult: {
data: {
editComment: { comment },
},
},
}
) => {
if (
!['PREMOD', 'REJECTED', 'SYSTEM_WITHHELD'].includes(comment.status)
@@ -139,7 +139,10 @@ const mapDispatchToProps = dispatch =>
);
const enhance = compose(
connect(mapStateToProps, mapDispatchToProps),
connect(
mapStateToProps,
mapDispatchToProps
),
withSettingsFragments,
withUpdateAssetSettings,
withMergedSettings('asset.settings', 'pending', 'mergedSettings')
@@ -22,7 +22,14 @@ class CommentHistoryContainer extends Component {
limit: 5,
cursor: this.props.root.me.comments.endCursor,
},
updateQuery: (previous, { fetchMoreResult: { me: { comments } } }) => {
updateQuery: (
previous,
{
fetchMoreResult: {
me: { comments },
},
}
) => {
const updated = update(previous, {
me: {
comments: {
@@ -97,7 +104,10 @@ const mapStateToProps = state => ({
});
export default compose(
connect(mapStateToProps, null),
connect(
mapStateToProps,
null
),
withCommentHistoryFragments,
withFetchMore
)(CommentHistoryContainer);
@@ -80,6 +80,7 @@ const mapStateToProps = state => ({
currentUser: state.auth.user,
});
export default compose(connect(mapStateToProps), withProfileQuery)(
ProfileContainer
);
export default compose(
connect(mapStateToProps),
withProfileQuery
)(ProfileContainer);
@@ -55,7 +55,10 @@ export default compose(
${Settings.fragments.root}
`,
}),
connect(mapStateToProps, mapDispatchToProps),
connect(
mapStateToProps,
mapDispatchToProps
),
withSlotElements({
slot: 'profileSettings',
propName: 'profileSettingsSlotElements',
@@ -117,8 +117,12 @@ export default class Comment extends React.Component {
}
componentWillReceiveProps(next) {
const { comment: { replies: prevReplies } } = this.props;
const { comment: { replies: nextReplies } } = next;
const {
comment: { replies: prevReplies },
} = this.props;
const {
comment: { replies: nextReplies },
} = next;
if (
prevReplies &&
nextReplies &&
@@ -243,7 +247,10 @@ export default class Comment extends React.Component {
}
loadNewReplies = () => {
const { comment: { replies, replyCount, id }, emit } = this.props;
const {
comment: { replies, replyCount, id },
emit,
} = this.props;
if (replyCount > replies.nodes.length) {
this.setState({ loadingState: 'loading' });
this.props
@@ -292,7 +299,11 @@ export default class Comment extends React.Component {
// getVisibileReplies returns a list containing comments
// which were authored by current user or comes before the `idCursor`.
getVisibileReplies() {
const { comment: { replies }, currentUser, liveUpdates } = this.props;
const {
comment: { replies },
currentUser,
liveUpdates,
} = this.props;
const idCursor = this.state.idCursors[0];
const userId = currentUser ? currentUser.id : null;
@@ -18,6 +18,7 @@ const ModerationLink = props =>
className="talk-embed-stream-moderation-link"
href={`${BASE_PATH}admin/moderate/${props.assetId}`}
target="_blank"
rel="noopener noreferrer"
>
{t('moderate_this_stream')}
</a>
@@ -211,7 +211,10 @@ class Stream extends React.Component {
root,
appendItemArray,
asset,
asset: { comment: highlightedComment, settings: { questionBoxEnable } },
asset: {
comment: highlightedComment,
settings: { questionBoxEnable },
},
postComment,
notify,
updateItem,
@@ -215,7 +215,10 @@ const mapStateToProps = state => ({
const enhance = compose(
withHooks(['preSubmit', 'postSubmit']),
connect(mapStateToProps, null)
connect(
mapStateToProps,
null
)
);
export default enhance(CommentBox);
@@ -33,4 +33,7 @@ const mapDispatchToProps = dispatch =>
dispatch
);
export default connect(null, mapDispatchToProps)(CommentNotFound);
export default connect(
null,
mapDispatchToProps
)(CommentNotFound);
@@ -54,7 +54,11 @@ class StreamContainer extends React.Component {
},
updateQuery: (
prev,
{ subscriptionData: { data: { commentEdited } } }
{
subscriptionData: {
data: { commentEdited },
},
}
) => {
// Ignore mutations from me.
// TODO: need way to detect mutations created by this client, and allow mutations from other clients.
@@ -87,7 +91,14 @@ class StreamContainer extends React.Component {
variables: {
assetId: this.props.asset.id,
},
updateQuery: (prev, { subscriptionData: { data: { commentAdded } } }) => {
updateQuery: (
prev,
{
subscriptionData: {
data: { commentAdded },
},
}
) => {
// Ignore mutations from me.
// TODO: need way to detect mutations created by this client, and allow mutations from other clients.
if (
@@ -488,7 +499,10 @@ const mapDispatchToProps = dispatch =>
export default compose(
withFragments(fragments),
withEmit,
connect(mapStateToProps, mapDispatchToProps),
connect(
mapStateToProps,
mapDispatchToProps
),
withPostComment,
// `talk-plugin-flags` has a custom error handling logic.
withPostFlag({ notifyOnError: false }),
@@ -78,7 +78,12 @@ function markLinks(body, keyPrefix) {
matches.forEach((match, i) => {
content.push(body.substring(index, match.index));
content.push(
<a key={`${keyPrefix}_${i}`} href={match.url} target="_blank">
<a
key={`${keyPrefix}_${i}`}
href={match.url}
target="_blank"
rel="noopener noreferrer"
>
{match.text}
</a>
);
+4 -1
View File
@@ -103,5 +103,8 @@ export default compose(
size: props => props.size,
defaultComponent: props => props.defaultComponent,
}),
connect(mapStateToProps, null)
connect(
mapStateToProps,
null
)
)(Slot);
+4 -1
View File
@@ -2,5 +2,8 @@ import { connect } from 'react-redux';
export default (mapStateToProps, ...rest) => BaseComponent => {
BaseComponent.mapStateToProps = mapStateToProps;
return connect(mapStateToProps, ...rest)(BaseComponent);
return connect(
mapStateToProps,
...rest
)(BaseComponent);
};
@@ -95,7 +95,10 @@ const mapDispatchToProps = dispatch =>
bindActionCreators({ updateUsername, updateStatus }, dispatch);
export default compose(
connect(mapStateToProps, mapDispatchToProps),
connect(
mapStateToProps,
mapDispatchToProps
),
withSetUsernameMutation,
withSetUsername
);
+4 -1
View File
@@ -121,4 +121,7 @@ const withSignUp = hoistStatics(WrappedComponent => {
return WithSignUp;
});
export default compose(withSettingsQuery, withSignUp);
export default compose(
withSettingsQuery,
withSignUp
);
@@ -198,5 +198,11 @@ const mapStateToProps = state => ({
* })(MyComponent);
*/
export default settings => {
return compose(connect(mapStateToProps, null), createHOC(settings));
return compose(
connect(
mapStateToProps,
null
),
createHOC(settings)
);
};
+5 -1
View File
@@ -9,7 +9,11 @@ export function createReduxEmitter(eventEmitter) {
// Handle apollo actions.
if (action.type.startsWith('APOLLO_')) {
if (action.type === 'APOLLO_SUBSCRIPTION_RESULT') {
const { operationName, variables, result: { data } } = action;
const {
operationName,
variables,
result: { data },
} = action;
eventEmitter.emit(`subscription.${operationName}.data`, {
variables,
data,