Skip to content

Commit da0de37

Browse files
authored
Merge pull request #162 from adobe/qe-fix
Quick edit: Remove url param on exit
2 parents 4081f3e + 5ca4be6 commit da0de37

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

  • nx/public/plugins/quick-edit/src

nx/public/plugins/quick-edit/src/utils.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
function removeQuickEditParam() {
2+
const url = new URL(window.location);
3+
url.searchParams.delete('quick-edit');
4+
window.history.replaceState({}, '', url);
5+
}
6+
17
export function pollConnection(ctx, action) {
28
ctx.initialized = false;
39
let count = 0;
@@ -18,6 +24,7 @@ async function handlePreview(ctx) {
1824
if (e.data.type === 'preview') {
1925
ctx.port.removeEventListener('message', previewListener);
2026
if (e.data.ok) {
27+
removeQuickEditParam();
2128
window.location.reload();
2229
} else {
2330
// eslint-disable-next-line no-alert
@@ -45,6 +52,7 @@ export function setupActions(ctx) {
4552

4653
// Create exit button
4754
const exitButton = createButton('quick-edit-exit', 'Exit', () => {
55+
removeQuickEditParam();
4856
window.location.reload();
4957
});
5058
exitButton.style.display = 'none';

0 commit comments

Comments
 (0)