Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix x-model checkbox weirdness #3351

Closed
wants to merge 2 commits into from

Conversation

austenc
Copy link
Contributor

@austenc austenc commented Dec 21, 2022

Seems like x-model should also use the skipForClone function. Normally extra listeners wouldn't cause a problem, but if you're binding to an array (for example, with multiple checkboxes) it causes incorrect values to be bound. Each value is doubled after a clone happens.

This was discovered while investigating livewire/livewire#5454

I've included a test for this that fails prior to skipForClone being added.

@calebporzio
Copy link
Collaborator

I'm going to close this because I feel iffy about wrapping the entirety of x-model in skipDuringClone.

As it's the event listeners we don't want registered and not the "binding of values" that also happens.

I'm closing for now because I'm trying to keep these repos clean and not in a wip state, but I'm super grateful and feel free to re-open with a different approach (maybe just wrapping the event listening in the skip function?)

Thanks!

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.

None yet

2 participants