Table: reset search on compare and reset comparison on search (https://github.com/woocommerce/woocommerce-admin/pull/1679)
This commit is contained in:
parent
4a19d27ec1
commit
365d493079
|
@ -151,7 +151,7 @@ class TableCard extends Component {
|
|||
}
|
||||
|
||||
onSearch( values ) {
|
||||
const { compareParam } = this.props;
|
||||
const { compareParam, searchBy } = this.props;
|
||||
// A comma is used as a separator between search terms, so we want to escape
|
||||
// any comma they contain.
|
||||
const labels = values.map( v => v.label.replace( ',', '%2C' ) );
|
||||
|
@ -159,6 +159,7 @@ class TableCard extends Component {
|
|||
updateQueryString( {
|
||||
filter: undefined,
|
||||
[ compareParam ]: undefined,
|
||||
[ searchBy ]: undefined,
|
||||
search: uniq( labels ).join( ',' ),
|
||||
} );
|
||||
} else {
|
||||
|
|
|
@ -110,7 +110,11 @@ export function onQueryChange( param, path = getPath(), query = getQuery() ) {
|
|||
return ( key, dir ) => updateQueryString( { orderby: key, order: dir }, path, query );
|
||||
case 'compare':
|
||||
return ( key, queryParam, ids ) =>
|
||||
updateQueryString( { [ queryParam ]: `compare-${ key }`, [ key ]: ids }, path, query );
|
||||
updateQueryString( {
|
||||
[ queryParam ]: `compare-${ key }`,
|
||||
[ key ]: ids,
|
||||
search: undefined,
|
||||
}, path, query );
|
||||
default:
|
||||
return value => updateQueryString( { [ param ]: value }, path, query );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue