Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
danharrin committed Dec 4, 2023
1 parent be11bcf commit 785c828
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
9 changes: 3 additions & 6 deletions packages/forms/resources/views/components/tabs.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,22 @@
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(() => {
if (component.id !== @js($this->getId())) {
return
}
let const = this.getTabs()
const tabs = this.getTabs()
if (! tabs.includes(this.tab)) {
this.tab = tabs[@js($getActiveTab()) - 1]
Expand Down
7 changes: 2 additions & 5 deletions packages/infolists/resources/views/components/tabs.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down

0 comments on commit 785c828

Please sign in to comment.