@rafaelindriago could you provide the code where you update the $search? And which version are you using? Try to update is
Properties are not updated when use "back" button in browser using Livewire 3
Hello guys, following the docs: https://livewire.laravel.com/docs/url#storing-in-history
I want to use this feature for a search bar to a data table component, but when i use the "back" button, the query string is changed, but the components properties are not updated on backend or "snapshot", so the component is not rendered again with the property values in the query string... 😵
use WithPagination;
#[Url(history: true, except: '')]
public $search = '';
#[Url(history: true, except: [])]
public $sortBy = [];
#[Url(history: true, except: [])]
public $filterBy = [];
Using @dump($this) i got the following:
#__id: "aBjTYdP9kr5KX2J2vMrw"
#__name: "user-data-table"
#listeners: []
#attributes: Livewire\Features\SupportAttributes\AttributeCollection {#620 ▶}
#withValidatorCallback: null
#rulesFromOutside: []
#messagesFromOutside: []
#validationAttributesFromOutside: []
+search: ""
+sortBy: []
+filterBy: []
+paginators: array:1 [▶]
The query string is updated if i search for something:
#__id: "aBjTYdP9kr5KX2J2vMrw"
#__name: "user-data-table"
#listeners: []
#attributes: Livewire\Features\SupportAttributes\AttributeCollection {#605}
#withValidatorCallback: null
#rulesFromOutside: []
#messagesFromOutside: []
#validationAttributesFromOutside: []
+search: "[email protected]"
+sortBy: []
+filterBy: []
+paginators: array:1 []
Then if i use the "back" button in browser, the $search property keeps with "[email protected]" 😐
Someone knows something about this? Maybe don't use this feature... Or "hook" into "popstate" event on JavaScript. 👀
Please or to participate in this conversation.