[V4] Select component not rerendering when `multiple` values changes
Hey guys, im currently making a Select field that can accept multiple values if the selected user role have specific permission. The issue is the component doesn't re-render when the selected role value changed. Here's my implementation:
Solution:Jump to solution
Found a workaround to avoid this issue. I just need to change the field's key to force the component to re-render at cost of need to do the permissions checking on layouts schema level
```php
Section::make('Sekolah yang Diawasi')
->icon(Heroicon::AcademicCap)...
2 Replies
So for example I have two roles which is Role A and Role B.
- Role A have manage_multiple permission
- Role B doesn't have the permission
When I select the Role A the sekolah field will accept multiple value, but when I change back to Role B the sekolah field will stuck in multiple state which are not what I wanted
this also happen in reverse, if I select Role B first, the target field will only accept one options, but when changing back to Role A it'll stuck on that single state
this "stuck" state issue also happens when applying the logic to
maxItems
function
I'm not sure which part that are wrong, I'm assuming it's filament's internal bug or smthSolution
Found a workaround to avoid this issue. I just need to change the field's key to force the component to re-render at cost of need to do the permissions checking on layouts schema level