Remove `qs` dependency from `<_Layout>`,
use native `URLSearchParams` instead.
This commit is contained in:
parent
c3888d658e
commit
1002f06d07
|
@ -16,7 +16,6 @@ import {
|
||||||
import { Children, cloneElement } from 'react';
|
import { Children, cloneElement } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { get, isFunction, identity, memoize } from 'lodash';
|
import { get, isFunction, identity, memoize } from 'lodash';
|
||||||
import { parse } from 'qs';
|
|
||||||
import { getHistory, getQuery } from '@woocommerce/navigation';
|
import { getHistory, getQuery } from '@woocommerce/navigation';
|
||||||
import {
|
import {
|
||||||
PLUGINS_STORE_NAME,
|
PLUGINS_STORE_NAME,
|
||||||
|
@ -190,15 +189,6 @@ class _Layout extends Component {
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
getQuery( searchString ) {
|
|
||||||
if ( ! searchString ) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
const search = searchString.substring( 1 );
|
|
||||||
return parse( search );
|
|
||||||
}
|
|
||||||
|
|
||||||
isWCPaySettingsPage() {
|
isWCPaySettingsPage() {
|
||||||
const { page, section, tab } = getQuery();
|
const { page, section, tab } = getQuery();
|
||||||
return (
|
return (
|
||||||
|
@ -212,7 +202,9 @@ class _Layout extends Component {
|
||||||
const { isEmbedded, ...restProps } = this.props;
|
const { isEmbedded, ...restProps } = this.props;
|
||||||
const { location, page } = this.props;
|
const { location, page } = this.props;
|
||||||
const { breadcrumbs } = page;
|
const { breadcrumbs } = page;
|
||||||
const query = this.getQuery( location && location.search );
|
const query = Object.fromEntries(
|
||||||
|
new URLSearchParams( location && location.search )
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LayoutContext.Provider
|
<LayoutContext.Provider
|
||||||
|
|
Loading…
Reference in New Issue