Skip to content

Commit

Permalink
Edit Site: Fix useLink prop mutation (WordPress#65739)
Browse files Browse the repository at this point in the history
Co-authored-by: tyxla <[email protected]>
Co-authored-by: ciampo <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
  • Loading branch information
4 people authored Oct 1, 2024
1 parent aa2c25a commit df27bd9
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 df27bd9

Please sign in to comment.