#.

3 messages · Page 1 of 1 (latest)

keen shoreBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

true rain
#

The issue you're facing is related to reactivity not being triggered correctly when programmatically adding items to the repeater.

Here’s a breakdown of the root cause and a recommended fix:

When you add a new item to the repeater programmatically, the conditional logic inside your disabled(fn ($get) => ...) closures does not reactively re-evaluate, because Livewire/Form components don't automatically re-evaluate conditional states (like disabled) unless a reactive change (such as user input) triggers it.

Why it works after reselecting the value:
Because manual interaction with the Radio field causes a re-evaluation of the form field state, hence triggering the condition inside the disabled(fn) closures.

#

Solution Options:

  1. Force re-evaluation via reactive dependency
    Ensure the fields are wrapped in ->reactive() and ->afterStateUpdated() to manually trigger updates:
  2. Trigger component refresh manually
    Instead of just setting the state, trigger a re-mount or full refresh:
  3. Workaround using Alpine.js (if necessary)
    If Livewire/Form builder still doesn't respond correctly, you can use Alpine.js to conditionally enable/disable based on Livewire state:

Recommendation
Your best bet is combining:

->reactive() on all interdependent fields

An artificial forceRefresh field to explicitly trigger reevaluation

Proper afterStateUpdated() triggers to nudge Livewire