Skip to content

Conversation

MayaKirova
Copy link
Contributor

Closes #16146

Split pipes in two, where one does the merging and the other tracks active rows and unmerges within related merge sequences.

Additional information (check all that apply):

  • Bug fix
  • New functionality
  • Documentation
  • Demos
  • CI/CD

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them

@MayaKirova MayaKirova added ❌ status: awaiting-test PRs awaiting manual verification grid labels Sep 26, 2025
@MayaKirova MayaKirova changed the base branch from master to 20.1.x September 26, 2025 09:34
@dkamburov
Copy link
Contributor

Openned rowPinning sample and pinned a row:
image
Also when I pin a row from cell merge sample I'm getting the following violation:
image

@MayaKirova
Copy link
Contributor Author

@dkamburov First one, I was not able to reproduce:
rowpin

Are you sure you have the latest changes in the branch or are there any additional steps needed to reproduce?

Second one is a sample issue. Because of the way the data is added, the same object refs are used in the grid sample:

for (let i = 1; i <= 600_000; i++) {
            const rnd = Math.floor(Math.random() * length);
            allData.push(INVOICE_DATA[rnd]);
        }

Hence, duplicate keys.

I fixed it in the sample.

@dkamburov
Copy link
Contributor

@MayaKirova appologize on the non reproducible sample: I do had some changes on that sample(didn't noticed them at first as they were from my previous testing on the cell merging):
image

[cellMergeMode]="'always'" to the grid and [merge]="true" to the columns

Copy link
Member

@mddragnev mddragnev left a comment

Choose a reason for hiding this comment

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

Additional, issues I found:

  1. If you click on any of the headers in the dev sample an error is thrown.
Screenshot 2025-09-29 at 4 01 33 pm
  1. Go to the performance project and enable the merging on all columns. Run the performance samples using npm run start:performance and go to the grid with 1 million records. Sort the Position column. Click on the first cell of the Registered column. An error is thrown with maximum callstack exceeded.
Screenshot 2025-09-29 at 3 53 58 pm 3. For 1 million records on the performance sample, it takes 4 to 5 seconds to merge the cells. Sometimes the browser crashes out of memory. This makes all other features that are pipe related to feel very slow.


}
result.splice(index, res.length, ...res);
result = result.slice(0, index).concat(res, result.slice(index + res.length));
Copy link
Member

Choose a reason for hiding this comment

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

Could we use a regular for-of loop here and instead of creating 3 new array coppies we can mutate the result (which is cloned beforehand) in place?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean going through all items in res and replacing each one in the original array with the unmerged version?

Copy link
Member

Choose a reason for hiding this comment

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

Yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean, we could. But it would look a bit ugly and also not sure how much more performant it would be considering that in the particular scenario:

  1. Go to the performance project and enable the merging on all columns. Run the performance samples using npm run start:performance and go to the grid with 1 million records. Sort the Position column. Click on the first cell of the Registered column. An error is thrown with maximum callstack exceeded.
Screenshot 2025-09-29 at 3 53 58 pm

It would need to loop through 300k+ records and replace each one.

Copy link
Member

Choose a reason for hiding this comment

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

I thought that

for(let i =0;i<res.length;++i) {
    result[index+i] = res[i];
}

would be faster because there is no array copying but changes the result in place. However, seems like the slice and concat version is perhaps more optimized by the js engine. I have tested this and, indeed, your current version is faster.

@tishko0 tishko0 added ✅ status: verified Applies to PRs that have passed manual verification and removed ❌ status: awaiting-test PRs awaiting manual verification labels Oct 3, 2025
@dkamburov
Copy link
Contributor

mouse wheel when there is cell merging is becoming choppy, it was faster before the changes and there is a difference when compared to a grid without cell merging
https://github.com/user-attachments/assets/da5b5e05-a0aa-48da-a9ae-6bd464a9584b

@MayaKirova
Copy link
Contributor Author

mouse wheel when there is cell merging is becoming choppy, it was faster before the changes and there is a difference when compared to a grid without cell merging https://github.com/user-attachments/assets/da5b5e05-a0aa-48da-a9ae-6bd464a9584b

@dkamburov I can confirm that none of the merge related pipes are actually triggered on mouse wheel, so it doesn't make sense for the change to effect it.

Are you sure it's not simply because of the large amount of data in the grid from the sample? It's choppy for me even without merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
grid version: 20.1.x ✅ status: verified Applies to PRs that have passed manual verification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve performance of navigation when there are merged cells.
4 participants