Skip to content

Conversation

@mondesirm
Copy link
Contributor

This PR allows using the Session attribute in functional API components.

Old way:

state('tab')->attribute(\Livewire\Attributes\Session::class, key: 'tab')

New way:

state('tab')->session(key: 'tab')

Notes:

  • I added a minimum of tests where I deemed necessary by mimicking the ones testing the Url attributes.
  • I believe a "default" argument would be awesome to add so I will make a PR to the Livewire repo before continuing here.

@taylorotwell taylorotwell merged commit ba3e609 into livewire:main Apr 8, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants