Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(TreeData): Reset the childrens prop when unflattening dataset in case it is being reused #1675

Merged

Conversation

jano-kucera
Copy link

@jano-kucera jano-kucera commented Sep 12, 2024

fixes #1657 again

Recreate the children array from scratch everytime instead of entity lookups.

There were some lint errors which I had to fix to be able to commit this.

Copy link

stackblitz bot commented Sep 12, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

codecov bot commented Sep 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.8%. Comparing base (7a6dd06) to head (a842223).
Report is 8 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1675     +/-   ##
========================================
- Coverage    99.8%   99.8%   -0.0%     
========================================
  Files         187     187             
  Lines       31082   31080      -2     
  Branches     9786    9783      -3     
========================================
- Hits        30993   30991      -2     
  Misses         89      89             

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jano-kucera jano-kucera changed the title Jank/fix children dataset behavior fix(TreeData): Reset the childrens prop when unflattening dataset in case it is being reused Sep 12, 2024
inputArray.forEach((item: any) => all[item[identifierPropName]] = item);
inputArray.forEach((item: any) => {
all[item[identifierPropName]] = item;
delete item[childrenPropName];
Copy link
Owner

@ghiscoding ghiscoding Sep 12, 2024

Choose a reason for hiding this comment

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

the only thing I wonder is why are you deleting after and not before the assignment, so why not inverse lines 197 & 198 ? is it because the item[childrenPropName] can contain children and you want to delete them from the item?

Copy link
Author

Choose a reason for hiding this comment

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

These lines are interchangeable without any affect on each other.

Line 197 maps the item reference under the set id field.
Line 198 removes the children property from the item.

I've added the line here as it was already a place where all items were iterated already.

Copy link
Owner

Choose a reason for hiding this comment

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

ok thanks, let's merge and hope this fixes it all :)

@ghiscoding ghiscoding merged commit 8d7683c into ghiscoding:master Sep 13, 2024
7 of 8 checks passed
@ghiscoding
Copy link
Owner

This is now release, but I even found another huge perf improvement via PR #1681 but of course I found it after I had already released everything lol 😆 So I'll wait a little before releasing this last perf, everything else is released. Thanks for the contribution. Cheers ⭐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tree Data Grid x Parent/Child Relation Dataset x Failures on subsequent component mount
2 participants