Issue: Reactive Field Visibility Not Working as Expected in ProductPriceResource
I'm having trouble with a reactive form field in ProductPriceResource. A 'Recurring Billing Period' field should show/hide based on a 'Price Type' ToggleButtons selection:
ToggleButtons::make('price_type') ->reactive() // ... other configurations ...TextInput::make('recurring_billing_period') ->visible(fn (callable $get) => $get('price_type') === ProductPrice::PRICETYPE_RECURRING) // ... other configurations ...
ToggleButtons::make('price_type') ->reactive() // ... other configurations ...TextInput::make('recurring_billing_period') ->visible(fn (callable $get) => $get('price_type') === ProductPrice::PRICETYPE_RECURRING) // ... other configurations ...
Problem: The 'Recurring Billing Period' field doesn't appear immediately when 'Recurring' is selected. It only shows up after saving the form.
What I've Tried: - Adding
->reactive()
->reactive()
to Section and Form - Using
afterStateUpdated
afterStateUpdated
on 'price_type' - Debug logging
This works in other resources (e.g., CourseResource) but not here. Any ideas on what might be causing this and how to fix it?