Skip to content

Commit 7a6794a

Browse files
authored
[6.x] Multisite - Fix localization switch sending the browser to /entries/null (#15230)
1 parent 3d73d2f commit 7a6794a

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

resources/js/components/entries/PublishForm.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -662,10 +662,6 @@ export default {
662662
} else {
663663
this.createLocalization(localization);
664664
}
665-
666-
if (this.isBase) {
667-
window.history.replaceState({}, '', localization.url + window.location.hash);
668-
}
669665
},
670666
671667
editLocalization(localization) {
@@ -694,6 +690,10 @@ export default {
694690
this.initialPublished = data.values.published;
695691
this.readOnly = data.readOnly;
696692
693+
if (this.isBase && localization.url) {
694+
window.history.replaceState({}, '', localization.url + window.location.hash);
695+
}
696+
697697
this.trackDirtyStateTimeout = setTimeout(() => (this.trackDirtyState = true), 500); // after any fieldtypes do a debounced update
698698
});
699699
},

resources/js/components/globals/PublishForm.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,6 @@ export default {
290290
switchToLocalization(localization) {
291291
this.localizing = localization.handle;
292292
293-
if (this.publishContainer === 'base') {
294-
window.history.replaceState({}, '', localization.url + window.location.hash);
295-
}
296-
297293
this.$axios.get(localization.url).then((response) => {
298294
const data = response.data;
299295
this.values = data.values;
@@ -309,6 +305,10 @@ export default {
309305
this.localizing = false;
310306
this.afterActionSuccessfullyCompleted(data);
311307
this.$nextTick(() => this.$refs.container.clearDirtyState());
308+
309+
if (this.publishContainer === 'base' && localization.url) {
310+
window.history.replaceState({}, '', localization.url + window.location.hash);
311+
}
312312
});
313313
},
314314

resources/js/components/terms/PublishForm.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,6 @@ export default {
421421
} else {
422422
this.createLocalization(localization);
423423
}
424-
425-
if (this.publishContainer === 'base') {
426-
window.history.replaceState({}, '', localization.url + window.location.hash);
427-
}
428424
},
429425
430426
editLocalization(localization) {
@@ -445,6 +441,10 @@ export default {
445441
this.reference = data.reference;
446442
this.localizing = false;
447443
this.$nextTick(() => this.$refs.container.clearDirtyState());
444+
445+
if (this.publishContainer === 'base' && localization.url) {
446+
window.history.replaceState({}, '', localization.url + window.location.hash);
447+
}
448448
});
449449
},
450450

0 commit comments

Comments
 (0)