From 8b781decdea2612694f5f1152fbcec26fb18db65 Mon Sep 17 00:00:00 2001 From: Jay George Date: Fri, 21 Aug 2026 13:23:56 +0100 Subject: [PATCH] Fix localization switch sending the browser to /entries/null Missing localizations have a null edit URL. Wait until after a successful load before updating history so we don't stringify null into the path. --- resources/js/components/entries/PublishForm.vue | 8 ++++---- resources/js/components/globals/PublishForm.vue | 8 ++++---- resources/js/components/terms/PublishForm.vue | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/resources/js/components/entries/PublishForm.vue b/resources/js/components/entries/PublishForm.vue index 2c888064b35..863a1a62490 100644 --- a/resources/js/components/entries/PublishForm.vue +++ b/resources/js/components/entries/PublishForm.vue @@ -662,10 +662,6 @@ export default { } else { this.createLocalization(localization); } - - if (this.isBase) { - window.history.replaceState({}, '', localization.url + window.location.hash); - } }, editLocalization(localization) { @@ -694,6 +690,10 @@ export default { this.initialPublished = data.values.published; this.readOnly = data.readOnly; + if (this.isBase && localization.url) { + window.history.replaceState({}, '', localization.url + window.location.hash); + } + this.trackDirtyStateTimeout = setTimeout(() => (this.trackDirtyState = true), 500); // after any fieldtypes do a debounced update }); }, diff --git a/resources/js/components/globals/PublishForm.vue b/resources/js/components/globals/PublishForm.vue index 1d8b17fb603..13f19efb23c 100644 --- a/resources/js/components/globals/PublishForm.vue +++ b/resources/js/components/globals/PublishForm.vue @@ -290,10 +290,6 @@ export default { switchToLocalization(localization) { this.localizing = localization.handle; - if (this.publishContainer === 'base') { - window.history.replaceState({}, '', localization.url + window.location.hash); - } - this.$axios.get(localization.url).then((response) => { const data = response.data; this.values = data.values; @@ -309,6 +305,10 @@ export default { this.localizing = false; this.afterActionSuccessfullyCompleted(data); this.$nextTick(() => this.$refs.container.clearDirtyState()); + + if (this.publishContainer === 'base' && localization.url) { + window.history.replaceState({}, '', localization.url + window.location.hash); + } }); }, diff --git a/resources/js/components/terms/PublishForm.vue b/resources/js/components/terms/PublishForm.vue index b5a2f60a61e..8ab651be887 100644 --- a/resources/js/components/terms/PublishForm.vue +++ b/resources/js/components/terms/PublishForm.vue @@ -421,10 +421,6 @@ export default { } else { this.createLocalization(localization); } - - if (this.publishContainer === 'base') { - window.history.replaceState({}, '', localization.url + window.location.hash); - } }, editLocalization(localization) { @@ -445,6 +441,10 @@ export default { this.reference = data.reference; this.localizing = false; this.$nextTick(() => this.$refs.container.clearDirtyState()); + + if (this.publishContainer === 'base' && localization.url) { + window.history.replaceState({}, '', localization.url + window.location.hash); + } }); },