Unit field do not auto updating when product changes inside the repeater (dependent select issue)
Package
Form builder
Package Version
v4
How can we help you?
I'm facing a small but confusing issue when using a Repeater with a dependent Select field for units that depend on the selected product.
When I first select a product, the unit field correctly auto-selects the first available unit, and it works perfectly.
However, when I change the product to another one, the unit list updates successfully (showing the correct new options), but the selected unit does not reset — it still keeps the old product’s unit selected.
The "sale_price" updates correctly when the product changes, but the unit itself stays stuck with the previous one unless I manually select it again.
---
Expected Behavior
- When I change the product, the unit field should automatically update to the first available unit of the newly selected product (just like it does on the first selection).
---
Actual Behavior
- The unit dropdown options refresh successfully with the new product’s units.
- The unit value does not change — it stays set to the previous unit.
- The "sale_price" updates correctly, which means the code logic runs, but "$set('unit_id', $first['unit_id'])" seems not to take effect when product changes.
---
Code
Here’s the simplified version of my Repeater setup (full working logic below):
GitHub Gist: https://gist.github.com/7498f02758331ddb586509d27201c69b.git
💡 Question
Is this the expected behavior (perhaps Filament prevents overwriting user-modified fields)?
If not, what’s the recommended way to reset a dependent Select field’s value when another field changes inside a Repeater?
Any help or insight would be really appreciated 🙏
Thank you for all the amazing work on Filament!
Gist
Filament help wanted
Filament help wanted. GitHub Gist: instantly share code, notes, and snippets.
0 Replies