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

Missing functions {setRow, setRowModesModel} from GridToolbarProps TypeScript definition #15993

Open
pattrickrice opened this issue Dec 23, 2024 · 1 comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information

Comments

@pattrickrice
Copy link

pattrickrice commented Dec 23, 2024

Steps to reproduce

Steps:

  1. Open this link to live example: (required)
    declare module '@mui/x-data-grid' {
    interface ToolbarPropsOverrides {
    setRows: (newRows: (oldRows: GridRowsProp) => GridRowsProp) => void;
    setRowModesModel: (
    newModel: (oldModel: GridRowModesModel) => GridRowModesModel,
    ) => void;
    }
    }

Current behavior

GridToolbarProps is missing these two functions. If there's a reason the interface doesn't have them, it's not documented.

Expected behavior

I would expect to not have to declare these types myself. I would assume we should be able to add these to GridToolbarProps and remove the unnecessary complication of needing to have users extend the declaration.

Context

I'm trying to upgrade to v7 and encountered this as a typescript error and had to search through the docs thinking I was doing something wrong.

Your environment

npx @mui/envinfo
  System:
    OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa)
  Binaries:
    Node: 16.20.2 - /usr/bin/node
    npm: 8.19.4 - /usr/bin/npm
    pnpm: 8.15.6 - /usr/bin/pnpm
  Browsers:
    Chrome: 131.0.6778.108

Search keywords: data-grid

Order ID:

@pattrickrice pattrickrice added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Dec 23, 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 Dec 23, 2024
@MBilalShafi
Copy link
Member

@pattrickrice Do you intend to receive setRows and setRowModesModel by default in GridToolbarProps?

The example you quoted is just a recipe where these props are passed as additional props using module augmentation to extend the existing functionality of the toolbar slot, could you expand on why do you expect them in the toolbar props by default?

A supporting live minimal reproduction example would be helpful to relate with the issue, here's a quick guide on preparing a reproduction: https://mui.com/x/introduction/support/#bug-reproductions

@MBilalShafi MBilalShafi added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Dec 24, 2024
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! status: waiting for author Issue with insufficient information
Projects
None yet
Development

No branches or pull requests

2 participants