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 ) {
|
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
|
// A comma is used as a separator between search terms, so we want to escape
|
||||||
// any comma they contain.
|
// any comma they contain.
|
||||||
const labels = values.map( v => v.label.replace( ',', '%2C' ) );
|
const labels = values.map( v => v.label.replace( ',', '%2C' ) );
|
||||||
|
@ -159,6 +159,7 @@ class TableCard extends Component {
|
||||||
updateQueryString( {
|
updateQueryString( {
|
||||||
filter: undefined,
|
filter: undefined,
|
||||||
[ compareParam ]: undefined,
|
[ compareParam ]: undefined,
|
||||||
|
[ searchBy ]: undefined,
|
||||||
search: uniq( labels ).join( ',' ),
|
search: uniq( labels ).join( ',' ),
|
||||||
} );
|
} );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -110,7 +110,11 @@ export function onQueryChange( param, path = getPath(), query = getQuery() ) {
|
||||||
return ( key, dir ) => updateQueryString( { orderby: key, order: dir }, path, query );
|
return ( key, dir ) => updateQueryString( { orderby: key, order: dir }, path, query );
|
||||||
case 'compare':
|
case 'compare':
|
||||||
return ( key, queryParam, ids ) =>
|
return ( key, queryParam, ids ) =>
|
||||||
updateQueryString( { [ queryParam ]: `compare-${ key }`, [ key ]: ids }, path, query );
|
updateQueryString( {
|
||||||
|
[ queryParam ]: `compare-${ key }`,
|
||||||
|
[ key ]: ids,
|
||||||
|
search: undefined,
|
||||||
|
}, path, query );
|
||||||
default:
|
default:
|
||||||
return value => updateQueryString( { [ param ]: value }, path, query );
|
return value => updateQueryString( { [ param ]: value }, path, query );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue