I am working on laravel and livewire where i load the lazyload the component and i want cancel the current loading component request when click on back button of browser. How can i do that.
listing-page.blade.php ->
<div>
@livewire('property-list', ['lazy' => true])
</div>
PropertyList componet –
class PropertyList extends Component
{
public $apiKey;
public $groupId;
public $properties = [];
public $checkinDate = '09-08-2024';
public $checkoutDate = '10-08-2024';
public $checkinTime;
public $checkoutTime;
public $location;
public $propertyCount = 1;
public function mount($location = null, $checkin = null, $checkout = null, $propertyCount)
{
$this->location = $location;
$this->checkinDate = date('d-m-Y', strtotime($checkin)) ?? date('d-m-Y');
$this->checkoutDate = date('d-m-Y', strtotime($checkout)) ?? date('d-m-Y', strtotime('+1 day'));
$this->propertyCount = $propertyCount;
$this->fetchProperties();
}
In property-list Component i fetch the property list where is take some time and when i click go back is not cancel current livewire component request, in network tab is showing two request, first is current component and second is back request.