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

Datagrid nested rows not picking up changes in expansion state #4335

Closed
1 of 3 tasks
hoiwingh opened this issue Feb 14, 2024 · 4 comments
Closed
1 of 3 tasks

Datagrid nested rows not picking up changes in expansion state #4335

hoiwingh opened this issue Feb 14, 2024 · 4 comments

Comments

@hoiwingh
Copy link
Contributor

What package(s) are you using?

  • Carbon for IBM Products (or Carbon for IBM Cloud & Cognitive)
  • Legacy/CDAI
  • Legacy/Security

Detailed description

We are using Datagrid with useNestedRows, and we want the nested rows to be expanded by default. We therefore provide expandedRowIds in initialState. However, the nested rows are not expanded even the row ids are included in expandedRowIds.

It appears to us that expandedRowIds are only consumed initially (see this code). Any subsequent changes to it are not picked up by useNestedRows. However, like any typical application, expandedRowIds is initially undefined/empty because it takes time to fetch data before expandedRowIds can be computed and provided to Datagrid. Therefore it is important that useNestedRows can pick up changes in expandedRowIds.

Steps to reproduce the issue

  1. Use Datagrid with useNestedRows
  2. Provide expandedRowIds in initialState
  3. Fetch data and render the Datagrid
@hoiwingh
Copy link
Contributor Author

hoiwingh commented Feb 14, 2024

In order to pick up changes in expandedRowIds, I think the expandedRowIds should be included in the dependencies array here - https://github.com/carbon-design-system/ibm-products/blob/main/packages/ibm-products/src/components/Datagrid/useNestedRows.js#L30

@elycheea elycheea moved this from Needs triage 🧐 to Needs refinement 🤓 in Carbon for IBM Products Feb 14, 2024
@matthewgallo
Copy link
Member

Possibly resolved in the issue @Ratheeshrajan worked on with incorrect ids in nested rows? Have you tried one the the latest releases that includes the fixes for selectable nested rows?

@elycheea elycheea moved this from Needs refinement 🤓 to Later 🏔️ in Carbon for IBM Products Mar 14, 2024
Copy link
Contributor

This issue is stale because it has been open for 30 days with no activity.
Remove the stale label or add a comment, otherwise this issue will be closed in 14 days.

Copy link
Contributor

github-actions bot commented May 9, 2024

This issue was closed because it has received no activity for 14 days.

@github-actions github-actions bot added the status: won’t fix 🔚 This will not be worked on label May 9, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 9, 2024
@github-project-automation github-project-automation bot moved this from Later 🏔️ to Done 🚀 in Carbon for IBM Products May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants