-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Labels
bugVerified bug by the Nova teamVerified bug by the Nova team
Description
- Laravel Version: 9.8.1
- Nova Version: 4.6.1
- PHP Version: 8.1.5
- Database Driver & Version: MySQL 8.0.21
- Operating System and Version: macOS Monterey 12.1
- Browser type and version: Google Chrome Version 101.0.4951.64
- Reproduction Repository: None (Private)
Description:
If a BooleanGroup field depends on another field and you want to change the displayed options based on the parent value, they never re-render.
However, if the BooleanGroup field in the reproduction code below is replaced for a Select field, the Select options are updated properly.
Detailed steps to reproduce the issue on a fresh Nova installation:
Select::make('Site', 'site_id')
->options([
1 => 'Site #1',
2 => 'Site #2',
])
->displayUsingLabels()
->searchable()
->rules(['required']),
BooleanGroup::make('Test')
->dependsOn(
['site_id'],
function (BooleanGroup $field, NovaRequest $request, FormData $formData) {
$options = $formData->site_id
? ['test' => 'Test']
: ['test2' => 'Test2'];
// Options are set to ['test2' => 'Test2'] on page load (because no site_id is selected)
// ...and they never change even if you select a site_id in the parent "site_id" Select field.
$field->options($options);
}
);Metadata
Metadata
Assignees
Labels
bugVerified bug by the Nova teamVerified bug by the Nova team