Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency react-redux to v7.2.8 #24306

Merged
merged 5 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 16 additions & 40 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions projects/packages/search/changelog/renovate-react-redux-7.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Updated package dependencies
2 changes: 1 addition & 1 deletion projects/packages/search/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"qss": "2.0.3",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-redux": "7.2.6",
"react-redux": "7.2.8",
"redux": "4.1.1",
"refx": "3.1.1",
"strip": "3.0.0",
Expand Down
4 changes: 4 additions & 0 deletions projects/packages/wordads/changelog/renovate-react-redux-7.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Updated package dependencies
2 changes: 1 addition & 1 deletion projects/packages/wordads/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"qss": "2.0.3",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-redux": "7.2.6",
"react-redux": "7.2.8",
"redux": "4.1.1",
"refx": "3.1.1",
"strip": "3.0.0",
Expand Down
24 changes: 17 additions & 7 deletions projects/plugins/jetpack/_inc/client/components/banner/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { connect as reduxConnect } from 'react-redux';
import classNames from 'classnames';
import { noop, size } from 'lodash';

Expand All @@ -26,7 +26,7 @@ import { isCurrentUserLinked, isConnectionOwner } from 'state/connection';

import './style.scss';

class Banner extends Component {
export class Banner extends Component {
static propTypes = {
callToAction: PropTypes.string,
className: PropTypes.string,
Expand Down Expand Up @@ -181,8 +181,18 @@ class Banner extends Component {
}
}

export default connect( state => ( {
currentVersion: getCurrentVersion( state ),
isCurrentUserLinked: isCurrentUserLinked( state ),
isConnectionOwner: isConnectionOwner( state ),
} ) )( Banner );
/**
* Redux-connect a Banner or subclass.
*
* @param {Banner} BannerComponent - Component to connect.
* @returns {Component} Wrapped component.
*/
export function connect( BannerComponent ) {
return reduxConnect( state => ( {
currentVersion: getCurrentVersion( state ),
isCurrentUserLinked: isCurrentUserLinked( state ),
isConnectionOwner: isConnectionOwner( state ),
} ) )( BannerComponent );
}

export default connect( Banner );
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import classNames from 'classnames';
/**
* Internal dependencies
*/
import Banner from 'components/banner';
import { Banner, connect as bannerConnect } from 'components/banner';
import Card from 'components/card';
import ConnectButton from 'components/connect-button';
import Gridicon from 'components/gridicon';

class ConnectionBanner extends Banner {
export class ConnectionBanner extends Banner {
static propTypes = {
title: PropTypes.string.isRequired,
className: PropTypes.string,
Expand Down Expand Up @@ -78,4 +78,4 @@ class ConnectionBanner extends Banner {
}
}

export default ConnectionBanner;
export default bannerConnect( ConnectionBanner );
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { mount, shallow } from 'enzyme';
/**
* Internal dependencies
*/
import ConnectionBanner from '../index';
import { ConnectionBanner } from '../index';
import ConnectButton from 'components/connect-button';

describe( 'ConnectionBanner', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
*/
import PropTypes from 'prop-types';
import React from 'react';
import { connect } from 'react-redux';
import { connect as reduxConnect } from 'react-redux';
import { noop } from 'lodash';
import Banner from 'components/banner';
import { Banner, connect as bannerConnect } from 'components/banner';

/**
* Internal dependencies
*/
import { arePromotionsActive, userCanManageModules } from 'state/initial-state';

class JetpackBanner extends Banner {
export class JetpackBanner extends Banner {
static propTypes = {
callToAction: PropTypes.string,
className: PropTypes.string,
Expand Down Expand Up @@ -54,12 +54,22 @@ class JetpackBanner extends Banner {
}
}

export default connect( ( state, ownProps ) => {
const userCanPurchasePlan = userCanManageModules( state );
/**
* Redux-connect a JetpackBanner or subclass.
*
* @param {JetpackBanner} Component - Component to connect.
* @returns {Component} Wrapped component.
*/
export function connect( Component ) {
return reduxConnect( ( state, ownProps ) => {
const userCanPurchasePlan = userCanManageModules( state );

return {
arePromotionsActive: arePromotionsActive( state ),
userCanPurchasePlan: userCanPurchasePlan,
hidePromotionBanner: !! ownProps.plan && ! userCanPurchasePlan,
};
} )( JetpackBanner );
return {
arePromotionsActive: arePromotionsActive( state ),
userCanPurchasePlan: userCanPurchasePlan,
hidePromotionBanner: !! ownProps.plan && ! userCanPurchasePlan,
};
} )( bannerConnect( Component ) );
}

export default connect( JetpackBanner );
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { getRedirectUrl } from '@automattic/jetpack-components';
/**
* Internal dependencies
*/
import JetpackBanner from 'components/jetpack-banner';
import { JetpackBanner, connect as bannerConnect } from 'components/jetpack-banner';

import './style.scss';

Expand Down Expand Up @@ -64,4 +64,4 @@ class ModuleOverridenBanner extends JetpackBanner {
}
}

export default ModuleOverridenBanner;
export default bannerConnect( ModuleOverridenBanner );
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/renovate-react-redux-7.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Updated package dependencies
4 changes: 2 additions & 2 deletions projects/plugins/jetpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"qss": "2.0.3",
"query-string": "7.0.0",
"react-page-visibility": "6.4.0",
"react-redux": "6.0.1",
"react-redux": "7.2.8",
"react-router-dom": "5.2.0",
"redux": "4.0.5",
"redux-thunk": "2.3.0",
Expand Down Expand Up @@ -143,7 +143,7 @@
"@testing-library/react-hooks": "8.0.0",
"@testing-library/user-event": "14.1.1",
"@types/react": "17.0.44",
"@types/react-redux": "7.1.23",
"@types/react-redux": "7.1.24",
"@wojtekmaj/enzyme-adapter-react-17": "0.6.3",
"@wordpress/api-fetch": "6.5.0",
"@wordpress/babel-plugin-import-jsx-pragma": "3.1.2",
Expand Down
7 changes: 7 additions & 0 deletions projects/plugins/jetpack/tools/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ module.exports = [
...sharedWebpackConfig.output,
libraryTarget: 'commonjs2',
},
resolve: {
...sharedWebpackConfig.resolve,
alias: {
...sharedWebpackConfig.resolve.alias,
'react-redux': require.resolve( 'react-redux/lib/alternate-renderers' ),
},
},
plugins: [
...jetpackWebpackConfig.StandardPlugins( {
DependencyExtractionPlugin: false,
Expand Down