Skip to content

Commit eaf08e2

Browse files
committed
fix: Clear usergroup selection before editing rows
Signed-off-by: Enjeck C <patrathewhiz@gmail.com>
1 parent 899b844 commit eaf08e2

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

cypress/e2e/column-usergroup.cy.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ describe('Test column ' + columnTitle, () => {
5959
cy.get('[data-cy="ncTable"] table tr td .user-bubble__name').contains(localUser.userId).should('be.visible')
6060

6161
cy.get('[data-cy="ncTable"] [data-cy="editRowBtn"]').click()
62+
cy.get('[data-cy="usergroupRowSelect"] .vs__deselect').click({ multiple: true })
6263
cy.get('[data-cy="usergroupRowSelect"] input').clear().type(nonLocalUser.userId)
6364
cy.get(`.vs__dropdown-menu [id="${nonLocalUser.userId}"]`).click()
6465
cy.get('[data-cy="editRowSaveButton"]').click()

src/shared/components/ncTable/partials/rowTypePartials/UsergroupForm.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,19 @@ export default {
6969
// Doing this in data() doesn't work due to timing issues,
7070
// since the data() function runs before the capabilities are fully initialized
7171
this.selectCircles = this.isCirclesEnabled ? this.column.usergroupSelectTeams : false
72-
72+
7373
let initialValue = this.value
7474
if (!initialValue || (Array.isArray(initialValue) && initialValue.length === 0)) {
7575
initialValue = this.column.usergroupDefault || []
7676
}
77-
77+
7878
const formatted = (Array.isArray(initialValue) ? initialValue : []).map(item => ({
7979
...(item ?? {}),
8080
// Adding a unique key such that removing items works correctly
8181
key: this.getKeyPrefix(item?.type) + (item?.id ?? ''),
8282
}))
8383
this.internalLocalValue = formatted
84-
84+
8585
if (formatted.length > 0) {
8686
this.$emit('update:value', formatted)
8787
}

0 commit comments

Comments
 (0)