From df27bd934838d56271224c76d54402886b88160c Mon Sep 17 00:00:00 2001 From: Marin Atanasov <8436925+tyxla@users.noreply.github.com> Date: Tue, 1 Oct 2024 10:29:24 +0300 Subject: [PATCH] Edit Site: Fix useLink prop mutation (#65739) Co-authored-by: tyxla Co-authored-by: ciampo Co-authored-by: Mamaduka --- packages/edit-site/src/components/routes/link.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/edit-site/src/components/routes/link.js b/packages/edit-site/src/components/routes/link.js index 4423eeeb1d6e8d..a34b37943a0799 100644 --- a/packages/edit-site/src/components/routes/link.js +++ b/packages/edit-site/src/components/routes/link.js @@ -33,14 +33,17 @@ export function useLink( params, state, shouldReplace = false ) { ...Object.keys( currentArgs ) ); + let extraParams = {}; if ( isPreviewingTheme() ) { - params = { - ...params, + extraParams = { wp_theme_preview: currentlyPreviewingTheme(), }; } - const newUrl = addQueryArgs( currentUrlWithoutArgs, params ); + const newUrl = addQueryArgs( currentUrlWithoutArgs, { + ...params, + ...extraParams, + } ); return { href: newUrl,