From 1002f06d07fbfab8804e32c16d131f69a4397da6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomek=20Wytr=C4=99bowicz?= Date: Mon, 17 Oct 2022 16:39:19 +0200 Subject: [PATCH] Remove `qs` dependency from `<_Layout>`, use native `URLSearchParams` instead. --- plugins/woocommerce-admin/client/layout/index.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/plugins/woocommerce-admin/client/layout/index.js b/plugins/woocommerce-admin/client/layout/index.js index 1ff5ff0b42c..a1400dedbc1 100644 --- a/plugins/woocommerce-admin/client/layout/index.js +++ b/plugins/woocommerce-admin/client/layout/index.js @@ -16,7 +16,6 @@ import { import { Children, cloneElement } from 'react'; import PropTypes from 'prop-types'; import { get, isFunction, identity, memoize } from 'lodash'; -import { parse } from 'qs'; import { getHistory, getQuery } from '@woocommerce/navigation'; import { 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() { const { page, section, tab } = getQuery(); return ( @@ -212,7 +202,9 @@ class _Layout extends Component { const { isEmbedded, ...restProps } = this.props; const { location, page } = this.props; const { breadcrumbs } = page; - const query = this.getQuery( location && location.search ); + const query = Object.fromEntries( + new URLSearchParams( location && location.search ) + ); return (