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(Table): select all rows reactivity issue #2200

Merged

Conversation

husamMousa
Copy link

@husamMousa husamMousa commented Sep 15, 2024

πŸ”— Linked issue

Resolves #2170

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR addresses a reactivity issue with the selectAllRows function in the table component. When selecting all rows, the previous implementation used Array.push() to modify the array in place, which did not properly trigger Vue's reactivity system. This caused the watch on the selected array not to fire correctly.

The solution was to create a new array by spreading selected.value, then appending unselected rows to this new array and reassigning it back to selected.value. This ensures that Vue's reactivity system detects the changes and triggers the necessary updates.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@benjamincanac benjamincanac changed the title Fix/table select all rows reactivity issue fix(Table): select all rows reactivity issue Sep 16, 2024
@benjamincanac benjamincanac merged commit 68124de into nuxt:dev Sep 16, 2024
2 checks passed
@benjamincanac
Copy link
Member

Thanks! 😊

@husamMousa husamMousa deleted the fix/table-select-all-rows-reactivity-issue branch September 17, 2024 13:35
patrick-hofmann pushed a commit to patrick-hofmann/nuxt-ui that referenced this pull request Oct 3, 2024
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.

UTable 'Select all' not updating ref events correctly
2 participants