From 59cdd3e72ea4049b27231827e817cbbe54e795e4 Mon Sep 17 00:00:00 2001 From: epiqueras Date: Mon, 24 Feb 2020 17:09:34 -0800 Subject: [PATCH] Edit Site: Append query vars in `NavigateToLink` properly. --- package-lock.json | 5 +++-- packages/edit-site/package.json | 1 + packages/edit-site/src/components/navigate-to-link/index.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7082f93ae92e6f..c7019a3c28bfb5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10418,6 +10418,7 @@ "@wordpress/i18n": "file:packages/i18n", "@wordpress/media-utils": "file:packages/media-utils", "@wordpress/notices": "file:packages/notices", + "@wordpress/url": "file:packages/url", "file-saver": "^2.0.2", "jszip": "^3.2.2" } @@ -19703,7 +19704,7 @@ }, "node-pre-gyp": { "version": "0.12.0", - "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.12.0.tgz", + "resolved": false, "integrity": "sha512-4KghwV8vH5k+g2ylT+sLTjy5wmUOb9vPhnM8NHvRf9dHmnW/CndrFXy2aRPaPST6dugXSdHXfeaHQm77PIz/1A==", "dev": true, "optional": true, @@ -19722,7 +19723,7 @@ }, "nopt": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", + "resolved": false, "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", "dev": true, "optional": true, diff --git a/packages/edit-site/package.json b/packages/edit-site/package.json index 5420d8022c76d3..4c61a7967ed0c6 100644 --- a/packages/edit-site/package.json +++ b/packages/edit-site/package.json @@ -33,6 +33,7 @@ "@wordpress/i18n": "file:../i18n", "@wordpress/media-utils": "file:../media-utils", "@wordpress/notices": "file:../notices", + "@wordpress/url": "file:../url", "file-saver": "^2.0.2", "jszip": "^3.2.2" }, diff --git a/packages/edit-site/src/components/navigate-to-link/index.js b/packages/edit-site/src/components/navigate-to-link/index.js index 2ac427803969d0..2b4e018bab1b51 100644 --- a/packages/edit-site/src/components/navigate-to-link/index.js +++ b/packages/edit-site/src/components/navigate-to-link/index.js @@ -2,6 +2,7 @@ * WordPress dependencies */ import { useState, useEffect, useMemo } from '@wordpress/element'; +import { addQueryArgs } from '@wordpress/url'; import { select } from '@wordpress/data'; import { Button } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; @@ -22,7 +23,7 @@ export default function NavigateToLink( { const effect = async () => { try { const { success, data } = await fetch( - `${ url }?_wp-find-template` + addQueryArgs( url, { '_wp-find-template': true } ) ).then( ( res ) => res.json() ); if ( success ) { let newTemplateId = data.ID;