filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
18.18k stars 2.84k forks source link

SelectFilter ->multiple() causes a second livewire call on page load #10664

Open bpudenz opened 9 months ago

bpudenz commented 9 months ago

Package

filament/tables

Package Version

v3.1.35

Laravel Version

v10.39.0

Livewire Version

v3.3.5

PHP Version

PHP 8.2

Problem description

Adding ->multiple() to a SelectFilter causes an extra livewire call on the first page hit. Comment it out and the POST to livewire does not happen.

Screenshot 2024-01-05 at 1 33 33 PM Screenshot 2024-01-05 at 1 33 43 PM

Expected behavior

I would expect a single GET request unless a change is made.

Steps to reproduce

Comment out a single line of code ->multiple() on a SelectFilter.

Reproduction repository

https://github.com/bpudenz/filter-issue

Relevant log output

No response

Donate 💰 to fund this issue

Fund with Polar

danharrin commented 9 months ago

The options for searchable & multi-selects are loaded after the initial page load. This is to reduce the initial page loading time. The options are not required until the user clicks on the dropdown, but we preload them so this process is faster.

bpudenz commented 9 months ago

Is there a way to opt out of preloading them? We have multi-selects on many pages, and loading a full page component a second time for all users so that a select box most users don't interact is ready on click seems unreasonable.

danharrin commented 8 months ago

I will look into it, but not guaranteeing anything.