-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Tree Data Grid x Parent/Child Relation Dataset x Failures on subsequent component mount #1657
Comments
…le-times fix(tree): unflattening tree->flat array multiple times, fixes #1657
Hi, I've hit upon this issue a long time ago, the children array didn't get reset when recreating the tree. Fixed it via this patch.
|
@jano-kucera I'm not sure why you're referencing this when it's already been fixed and pushed to production? If there's another problem or if this is a better fix than mine, then please contribute a fix as a new pull request so that it can benefit everyone. Thanks Actually I wonder if the delete prop has better perf compare to the slickgrid-universal/packages/common/src/services/utilities.ts Lines 208 to 214 in 78653f9
cc @tnaum-ms Also note that another user also found and provided another perf improvement related to Tree Data in this PR #1670 that I just merged today (to be released soon) |
From the code snippet, your fix does not handle removing children - that's why I commented :). |
@jano-kucera then a Pull Request would be welcome to fix it, thanks |
Also I just realized a big problem in the implementation, you access the |
Discussed in #1655
Originally posted by tnaum-ms August 28, 2024
I'm currently investigating an issue that arises when I mount my SlickGrid Tree Data as a React component for the second time. The problem occurs when I toggle between different data view formats in my application. Specifically, switching away from the Tree Data view and then returning to it results in a failure of the Tree Data Component.
The data set I’m working with follows a Parent/Child structure, where the
id
andparentId
fields are of typestring
.(It would be helpful to include a note in the documentation indicating the preferred or faster data input method.)
The SlickGrid Tree Data Grid throws the following error:
Upon investigation, I discovered that on the second mount (not just a second render), one of the internal data mutation functions introduces duplicates into my data set. This causes the
ensureIdUniqueness
function to fail.The issue seems to be related to the function located here:
slickgrid-universal/packages/common/src/services/utilities.ts
Line 158 in ce8b400
This specific loop appears to be introducing duplicates:
slickgrid-universal/packages/common/src/services/utilities.ts
Lines 173 to 187 in ce8b400
I'm continuing to investigate the root cause, but since this issue only occurs on the second mount, I haven’t yet identified any obvious side effects. If this is something you’ve encountered before, I would greatly appreciate any insights or suggestions you could share.
Thank you for your assistance.
Best, Tomasz
The text was updated successfully, but these errors were encountered: