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

[data grid] onRowSelectionModelChange firing twice #15079

Closed
1 task done
jkunwar opened this issue Oct 24, 2024 · 3 comments · Fixed by #15184
Closed
1 task done

[data grid] onRowSelectionModelChange firing twice #15079

jkunwar opened this issue Oct 24, 2024 · 3 comments · Fixed by #15184
Assignees
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Selection Related to the data grid Selection feature

Comments

@jkunwar
Copy link

jkunwar commented Oct 24, 2024

Search keywords

onRowSelectionModelChange

Latest version

  • I have tested the latest version

Affected products

Data Grid

Steps to reproduce

Link to live example: (required)
https://codesandbox.io/p/sandbox/headless-microservice-x38xc6

Steps:

  1. Use getRowId={(row) => row.id}, instead of defining id field in the column definition
  2. set filterMode="server"

Current behavior

The onRowSelectionModelChange handler is triggered twice when trying to update any state within the handler, if getRowId is used to set the unique row ID and filterMode is set to 'server'. However, when filterMode is set to 'client', the handler is only triggered once.

Expected behavior

onRowSelectionModelChange should be triggered only once.

Context

The response data doesn't include an id field but uses a different key as the record identifier. I am using getRowId to assign the id field.

Your environment

System:
OS: Linux 6.8 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
Binaries:
Node: 22.1.0 - ~/.nvm/versions/node/v22.1.0/bin/node
npm: 10.7.0 - ~/.nvm/versions/node/v22.1.0/bin/npm
pnpm: Not Found
Browsers:
Chrome: 130.0.6723.58
npmPackages:
@emotion/react: ^11.13.3 => 11.13.3
@emotion/styled: ^11.13.0 => 11.13.0
@mui/core-downloads-tracker: 6.1.5
@mui/material: ^6.1.5 => 6.1.5
@mui/private-theming: 6.1.5
@mui/styled-engine: 6.1.5
@mui/system: 6.1.5
@mui/types: 7.2.18
@mui/utils: 6.1.5
@mui/x-data-grid: ^7.21.0 => 7.21.0
@mui/x-internals: 7.21.0
@types/react: ^18.3.10 => 18.3.10
react: ^18.3.1 => 18.3.1
react-dom: ^18.3.1 => 18.3.1
typescript: ^4.9.5 => 4.9.5

Order ID or Support key 💳 (optional)

No response

@jkunwar jkunwar added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 24, 2024
@github-actions github-actions bot added the component: data grid This is the name of the generic UI component, not the React module! label Oct 24, 2024
@KenanYusuf KenanYusuf changed the title [data grid] onRowSelectionModelChange firing twice [data grid] onRowSelectionModelChange firing twice Oct 24, 2024
@KenanYusuf KenanYusuf added the feature: Selection Related to the data grid Selection feature label Oct 24, 2024
@KenanYusuf
Copy link
Member

@MBilalShafi
Copy link
Member

@KenanYusuf Kindly assign this one to me, I have another related issue that also concerns onRowSelectionModelChange. Will try to sort them out together.

@KenanYusuf KenanYusuf removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 24, 2024
Copy link

github-actions bot commented Nov 4, 2024

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

@jkunwar How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Selection Related to the data grid Selection feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants