livewire / volt

Volt is an elegantly crafted functional API for Livewire.
https://livewire.laravel.com/docs/volt
MIT License
327 stars 19 forks source link

state(['search'])->url() does not update the url in anonymous component #8

Closed inmanturbo closed 1 year ago

inmanturbo commented 1 year ago

Volt Version

1.0@beta.1

Laravel Version

10.6.1

PHP Version

8.2.8

Database Driver & Version

No response

Description

The url is not updating with the state. The search functionality IS working fine. Also manually typing in a query string into the url and hitting enter works as well

Steps To Reproduce

<?php

use App\Models\Post;
use function Livewire\Volt\{computed, state};

state(['search'])->url();

$posts = computed(function () {
    return Post::where('title', 'like', '%'.$this->search.'%')->get();
});

?>

<div>
    @volt('posts')
     <div>
      <input wire:model="search" type="search" placeholder="Search posts by title...">

      <h1>Search Results:</h1>

      <ul>
          @foreach($this->posts as $post)
              <li wire:key="{{ $post->id }}">{{ $post->title }}</li>
          @endforeach
      </ul>
    </div>
   @endvolt
</div>
inmanturbo commented 1 year ago

I'm closing this. I could not reproduce in a fresh demo app -- it may not be a bug ...