Skip to content

Commit

Permalink
Merge pull request #3726 from 10up/fix/sync-url-after-enabling-feature
Browse files Browse the repository at this point in the history
Fix: Sync page URL after enabling the feature that requires sync
  • Loading branch information
felipeelia authored Oct 27, 2023
2 parents adddf5b + fbafcc8 commit 24b9576
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions assets/js/sync/src/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
* @returns {void}
*/
export const clearSyncParam = () => {
window.history.replaceState(
{},
document.title,
document.location.pathname + document.location.search.replace(/&do_sync/, ''),
);
const url = new URL(document.location.href);
url.searchParams.delete('do_sync');
window.history.replaceState({}, document.title, url);
};

/**
Expand Down

0 comments on commit 24b9576

Please sign in to comment.