Skip to content

Commit

Permalink
Edit Site: Fix useLink prop mutation (#65739)
Browse files Browse the repository at this point in the history
Co-authored-by: tyxla <tyxla@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
  • Loading branch information
4 people authored and draganescu committed Oct 2, 2024
1 parent 91578d0 commit d3780dd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/edit-site/src/components/routes/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d3780dd

Please sign in to comment.