Skip to content

Commit 4935f0b

Browse files
authored
Merge pull request #17570 from rancher/gha-portpr-25579346809-1
[backport v2.11.14] Use row key instead of index key in v-for
2 parents 47ff04d + be15d69 commit 4935f0b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

shell/components/SortableTable/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { mapGetters } from 'vuex';
33
import { defineAsyncComponent, useTemplateRef, onMounted, onBeforeUnmount } from 'vue';
44
import day from 'dayjs';
55
import isEmpty from 'lodash/isEmpty';
6-
import { dasherize, ucFirst } from '@shell/utils/string';
6+
import { dasherize, ucFirst, randomStr } from '@shell/utils/string';
77
import { get, clone } from '@shell/utils/object';
88
import { removeObject } from '@shell/utils/array';
99
import { Checkbox } from '@components/Form/Checkbox';
@@ -714,7 +714,7 @@ export default {
714714
grp.rows.forEach((row) => {
715715
const rowData = {
716716
row,
717-
key: this.get(row, this.keyField),
717+
key: this.get(row, this.keyField) ?? randomStr(),
718718
showSubRow: this.showSubRow(row, this.keyField),
719719
canRunBulkActionOfInterest: this.canRunBulkActionOfInterest(row),
720720
columns: []
@@ -1354,7 +1354,7 @@ export default {
13541354
</slot>
13551355
<template
13561356
v-for="(row, i) in groupedRows.rows"
1357-
:key="i"
1357+
:key="row.key"
13581358
>
13591359
<slot
13601360
name="main-row"

0 commit comments

Comments
 (0)