Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit ad48c96

Browse files
committed
Merge branch 'master' into release/2.5
2 parents 4a1a6ac + 6527284 commit ad48c96

File tree

24 files changed

+534
-798
lines changed

24 files changed

+534
-798
lines changed

CONTRIBUTING.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ Run `$ npm run package-plugin` to trigger install and build, and then create a z
4848

4949
These instructions cover new releases of the blocks plugin for those with commit access.
5050

51+
### Prerequisites
52+
53+
- Have [Github's Hub](https://github.com/github/hub) cli installed and authenticated.
54+
5155
**Before any release** ensure you update:
5256

5357
- The `readme.txt` file supported versions, changelog and list of blocks if the release includes new blocks.
@@ -80,6 +84,36 @@ This will ask for a tagged version number, check it out from GitHub, check out t
8084

8185
__Important:__ Before running the release script ensure you have already pushed a new release to GitHub.
8286

87+
### Bumping the version
88+
89+
After you release, create a commit to master that updates the version to the next minor with a `-dev` suffix. For example, if you just released `2.5.0`, you'd do an update changing the version to `2.6.0-dev`. See an [example here](https://github.com/woocommerce/woocommerce-gutenberg-products-block/commit/e27f053e7be0bf7c1d376f5bdb9d9999190ce158).
90+
91+
## Updating a single file in WordPress.org
92+
93+
Sometimes, we need to update a single file in WordPress.org without wanting to do a full release, for example, updating the `readme.txt` versions or descriptions. In order to do that, refer to the _[Editing Existing Files](https://developer.wordpress.org/plugins/wordpress-org/how-to-use-subversion/#editing-existing-files)_ section of the Subversion guide in developer.wordpress.org or follow these steps:
94+
95+
1. Checkout the plugin repo:
96+
97+
```
98+
svn co "http://plugins.svn.wordpress.org/woo-gutenberg-products-block/"
99+
cd woo-gutenberg-products-block
100+
```
101+
102+
2. Modify the files you want to change in `trunk` or `tags/x.y.z`.
103+
104+
3. Check your changes with:
105+
106+
```
107+
svn stat
108+
svn diff
109+
```
110+
111+
4. Commit the changes to the server:
112+
113+
```
114+
svn ci -m "Updated readme.txt description"
115+
```
116+
83117
## Publishing `@woocommerce/block-library`
84118

85119
In the past, we published the blocks to NPM at [@woocommerce/block-library](https://www.npmjs.com/package/@woocommerce/block-library).
Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,39 @@
11
/**
22
* External dependencies
33
*/
4-
import { Component } from 'react';
4+
import { useState } from '@wordpress/element';
55
import PropTypes from 'prop-types';
6-
import withQueryStringValues from '@woocommerce/base-hocs/with-query-string-values';
76

87
/**
98
* Internal dependencies
109
*/
1110
import ProductList from './index';
1211

13-
class ProductListContainer extends Component {
14-
onPageChange = ( newPage ) => {
15-
this.props.updateQueryStringValues( {
16-
product_page: newPage,
17-
} );
12+
const ProductListContainer = ( { attributes } ) => {
13+
const [ currentPage, setPage ] = useState( 1 );
14+
const [ currentSort, setSort ] = useState( attributes.orderby );
15+
const onPageChange = ( newPage ) => {
16+
setPage( newPage );
1817
};
19-
20-
onSortChange = ( event ) => {
18+
const onSortChange = ( event ) => {
2119
const newSortValue = event.target.value;
22-
this.props.updateQueryStringValues( {
23-
product_sort: newSortValue,
24-
product_page: 1,
25-
} );
20+
setSort( newSortValue );
21+
setPage( 1 );
2622
};
2723

28-
render() {
29-
// eslint-disable-next-line camelcase
30-
const { attributes, product_page, product_sort } = this.props;
31-
const currentPage = parseInt( product_page );
32-
const sortValue = product_sort || attributes.orderby; // eslint-disable-line camelcase
33-
34-
return (
35-
<ProductList
36-
attributes={ attributes }
37-
currentPage={ currentPage }
38-
onPageChange={ this.onPageChange }
39-
onSortChange={ this.onSortChange }
40-
sortValue={ sortValue }
41-
/>
42-
);
43-
}
44-
}
24+
return (
25+
<ProductList
26+
attributes={ attributes }
27+
currentPage={ currentPage }
28+
onPageChange={ onPageChange }
29+
onSortChange={ onSortChange }
30+
sortValue={ currentSort }
31+
/>
32+
);
33+
};
4534

4635
ProductListContainer.propTypes = {
4736
attributes: PropTypes.object.isRequired,
48-
// From withQueryStringValues
49-
product_page: PropTypes.oneOfType( [ PropTypes.number, PropTypes.string ] ),
50-
product_sort: PropTypes.string,
51-
};
52-
53-
ProductListContainer.defaultProps = {
54-
product_page: 1,
5537
};
5638

57-
export default withQueryStringValues( [ 'product_page', 'product_sort' ] )(
58-
ProductListContainer
59-
);
39+
export default ProductListContainer;

assets/js/base/hocs/test/with-query-string-values.js

Lines changed: 0 additions & 123 deletions
This file was deleted.

assets/js/base/hocs/with-query-string-values.js

Lines changed: 0 additions & 97 deletions
This file was deleted.

0 commit comments

Comments
 (0)