Skip to content

fix(tgrid): create and assign unique data ids#3840

Merged
gedinakova merged 2 commits intovnextfrom
ibarakov/fix-3829
Dec 8, 2025
Merged

fix(tgrid): create and assign unique data ids#3840
gedinakova merged 2 commits intovnextfrom
ibarakov/fix-3829

Conversation

@onlyexeption
Copy link
Copy Markdown
Contributor

Closes #3829

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue with tree grid data by ensuring unique IDs across duplicated records. Previously, the code was directly pushing the same data objects multiple times, resulting in duplicate IDs. Now, each record gets a unique ID by applying an offset based on the iteration.

Key changes:

  • Modified data population logic to create unique IDs for duplicated records using an offset calculation
  • Reduced iteration count from 15,000 to 9,000
  • Removed duplicate primaryKey attribute from the tree grid template

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tree-grid-export-visualization.component.ts Updated constructor to create new objects with unique IDs and ParentIDs using offset calculations
tree-grid-export-visualization.component.html Removed duplicate primaryKey attribute declaration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

...item,
ID: item.ID + offset,
ParentID: item.ParentID === -1 ? -1 : item.ParentID + offset,
OrderDate: new Date(item.OrderDate)
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating a new Date object from item.OrderDate assumes it's already a valid date input. If item.OrderDate is already a Date object, this creates a copy; if it's a string or timestamp, it parses it. However, if OrderDate is already being shared as a reference across multiple items in the original data, this could be necessary. Consider whether this conversion is intentional for all data types or if it should handle different input formats explicitly.

Suggested change
OrderDate: new Date(item.OrderDate)
OrderDate: (item.OrderDate instanceof Date)
? new Date(item.OrderDate.getTime())
: (typeof item.OrderDate === 'string' || typeof item.OrderDate === 'number')
? new Date(item.OrderDate)
: null

Copilot uses AI. Check for mistakes.
@gedinakova gedinakova merged commit 89fa255 into vnext Dec 8, 2025
4 checks passed
@gedinakova gedinakova deleted the ibarakov/fix-3829 branch December 8, 2025 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants