diff --git a/packages/forms/resources/views/components/tabs.blade.php b/packages/forms/resources/views/components/tabs.blade.php index 98ff0e2da96..42d211bfdc9 100644 --- a/packages/forms/resources/views/components/tabs.blade.php +++ b/packages/forms/resources/views/components/tabs.blade.php @@ -11,17 +11,14 @@ tab: @if ($isTabPersisted() && filled($persistenceId = $getId())) $persist(null).as('tabs-{{ $persistenceId }}') @else null @endif, init: function () { - // Watcher is first as Alpine.js does not currently - // support defining a constant as the first thing in - // the function body. - this.$watch('tab', () => this.updateQueryString()) - const tabs = this.getTabs() if ((! this.tab) || (! tabs.includes(this.tab))) { this.tab = tabs[@js($getActiveTab()) - 1] } + this.$watch('tab', () => this.updateQueryString()) + Livewire.hook('commit', ({ component, commit, succeed, fail, respond }) => { succeed(({ snapshot, effect }) => { $nextTick(() => { @@ -29,7 +26,7 @@ return } - let const = this.getTabs() + const tabs = this.getTabs() if (! tabs.includes(this.tab)) { this.tab = tabs[@js($getActiveTab()) - 1] diff --git a/packages/infolists/resources/views/components/tabs.blade.php b/packages/infolists/resources/views/components/tabs.blade.php index 7ba46212b0e..c413a118eaa 100644 --- a/packages/infolists/resources/views/components/tabs.blade.php +++ b/packages/infolists/resources/views/components/tabs.blade.php @@ -10,17 +10,14 @@ tab: @if ($isTabPersisted() && filled($persistenceId = $getId())) $persist(null).as('tabs-{{ $persistenceId }}') @else null @endif, init: function () { - // Watcher is first as Alpine.js does not currently - // support defining a constant as the first thing in - // the function body. - this.$watch('tab', () => this.updateQueryString()) - const tabs = this.getTabs() if ((! this.tab) || (! tabs.includes(this.tab))) { this.tab = tabs[@js($getActiveTab()) - 1] } + this.$watch('tab', () => this.updateQueryString()) + Livewire.hook('commit', ({ component, commit, succeed, fail, respond }) => { succeed(({ snapshot, effect }) => { $nextTick(() => {