Skip to content

Conversation

@ljk0071
Copy link

@ljk0071 ljk0071 commented Dec 21, 2025

#2697
#4546

Fix x-model binding for select options rendered via x-for

@ekwoka
Copy link
Contributor

ekwoka commented Dec 21, 2025

🤔 This feels maybe too opinionated...

since you could have logic associated with it changing...that this is now going to trigger...

@ljk0071
Copy link
Author

ljk0071 commented Dec 22, 2025

After checking, I confirmed that @change was being triggered even when the x-model value remained the same. To address this, I’ve updated the logic to dispatch the change event only when the current value is missing from the updated options list.

If you feel that triggering the event upon an x-model change is problematic, I’d like to share my perspective. I viewed this approach as being more aligned with the declarative nature that Alpine.js pursues, where the UI reacts naturally to state changes.

Replaces manual :selected bindings for option elements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants