Skip to content

[Bug][Grid] Incorrect Rendering of Unique Rows by keyΒ #677

@prochorz

Description

@prochorz

Incorrect Rendering of Unique Rows in @progress/[email protected]

πŸ›  Issue Summary

When using @progress/[email protected], I encountered an issue where unique items are not rendered correctly due to how Vue assigns component keys. This issue affects the virtual scrolling behavior, leading to unexpected UI inconsistencies.

πŸ” Observed Behavior

  • The keys assigned to rows in the grid do not ensure uniqueness when using Vue’s virtual DOM.
  • As a result, Vue reuses incorrect components, causing rendering issues.
  • This is particularly problematic in scenarios involving detail rows and virtual scrolling, where incorrect keys lead to unexpected UI behavior.

βœ… Solution

I applied a patch using [patch-package](https://github.com/ds300/patch-package) that resolves the issue by modifying the key assignment logic in Grid.js.

πŸ”„ Diff of the Fix:
diff --git a/node_modules/@progress/kendo-vue-grid/dist/esm/Grid.js b/node_modules/@progress/kendo-vue-grid/dist/esm/Grid.js
index 422ccc5..6fa86ae 100644
--- a/node_modules/@progress/kendo-vue-grid/dist/esm/Grid.js
+++ b/node_modules/@progress/kendo-vue-grid/dist/esm/Grid.js
@@ -1703,7 +1703,7 @@ var GridVue2 = {
       // The RowIndexes when in Detail Row template
       var masterRowIndex = rowIndex * 2 + rowIndexStart;
       var detailRowIndex = rowIndex * 2 + rowIndexStart + 1;
-      return [
+      return h(Vue.Fragment, { key: rowId + detailRowId, }, [
       // @ts-ignore function children
       h(GridRow, {
         key: rowId,
@@ -1796,7 +1796,7 @@ var GridVue2 = {
         ariaColIndex: 2 + (this.$props.group ? this.$props.group.length : 0),
         detail: this.$props.detail ? detailRenderFunction : undefined,
         id: navigationTools.generateNavigatableId("".concat(detailRowId, "-dcell"), idPrefix)
-      })])];
+      })])]);
     }, this) || h("tr", {
       "class": "k-table-row k-grid-norecords"
     }, [h("td", {

πŸ’‘ Expected Behavior

  • Each row should receive a unique key that prevents Vue from incorrectly reusing components.
  • The grid should render correctly when virtual scrolling is enabled.
  • Expanding/collapsing detail rows should work as expected without incorrect state reuse.

πŸ— Steps to Reproduce

  1. Use @progress/[email protected] in a project with virtual scrolling.
  2. Populate the grid with dynamic data.
  3. Observe that items are incorrectly reused, affecting row rendering.

πŸ”„ Environment

  • Package Version: @progress/[email protected]
  • Framework: Vue 3
  • Additional Context: Issue is related to Vue’s key handling in virtual lists.

Would appreciate any insights on whether this is a known issue or if there's a recommended fix! πŸš€

Metadata

Metadata

Assignees

Labels

BugItem which indicates that something is not workingKendo UI for Vue

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions