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] unstable_headerFilters not showing correct value with controlled filterModel #10325

Closed
2 tasks done
henry-young opened this issue Sep 13, 2023 · 2 comments · Fixed by #10338
Closed
2 tasks done
Assignees
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module!

Comments

@henry-young
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Link to live example: https://codesandbox.io/s/musing-lake-9ltjdm?file=/Demo.tsx

Steps:

  1. Add the unstable_headerFilters prop to a DataGridPro/Premium component which has a controlled filterModel
  2. Type a single character into one of the header column filters (and observe)
  3. Open the traditional column filter by clicking the funnel icon (and observe)

Current behavior 😯

The header filter input briefly displays the character(s) you typed, but the field is reset to "". The column displays like a filter has been enabled, with the filter menu button visible and the header filter input "X" clear button visible.
Clicking the filter menu button will show the filter correctly.

Expected behavior 🤔

The header filter input should show the correct value of the filter being applied to the column.

Context 🔦

I use a cache to remember the state of the DataGrid when navigating between pages. Most frequently the user will perform a search on the dataset using some specific criteria, investigate a specific row's detail page (on a detail view route), and then they navigate back to the table. Without maintaining the cache, they would have to set up their specific criteria again.

I am using the unstable_headerFilter in an attempt to replicate the behaviour of an old library we are deprecating since we upgraded to using DataGridPremium.

I have also noticed this behaviour doesn't appear when

Your environment 🌎

npx @mui/envinfo
  System:
    OS: macOS 13.5.2
  Binaries:
    Node: 16.18.1 - ~/.nvm/versions/node/v16.18.1/bin/node
    Yarn: 3.6.1 - ~/.nvm/versions/node/v16.18.1/bin/yarn
    npm: 8.19.2 - ~/.nvm/versions/node/v16.18.1/bin/npm
  Browsers:
    Chrome: 116.0.5845.187
    Edge: 116.0.1938.81
    Safari: 16.6
  npmPackages:
    @emotion/react:  11.10.5
    @emotion/styled:  11.10.5
    @mui/base:  5.0.0-alpha.110
    @mui/core-downloads-tracker:  5.11.0
    @mui/icons-material:  5.11.0
    @mui/lab:  5.0.0-alpha.112
    @mui/material:  5.11.0
    @mui/private-theming:  5.11.0
    @mui/styled-engine:  5.11.0
    @mui/styles:  5.11.2
    @mui/system:  5.11.0
    @mui/types:  7.2.3
    @mui/utils:  5.11.0
    @mui/x-data-grid:  6.13.0
    @mui/x-data-grid-premium:  6.13.0
    @mui/x-data-grid-pro:  6.13.0
    @mui/x-date-pickers:  5.0.11
    @mui/x-date-pickers-pro:  5.0.11
    @mui/x-license-pro:  5.17.12
    @types/react:  18.0.26
    react:  18.2.0
    react-dom:  18.2.0
    styled-components:  5.3.6
    typescript:  5.1.6
Tested in Chrome

Order ID or Support key 💳 (optional)

71984

@henry-young henry-young added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 13, 2023
@MBilalShafi MBilalShafi added bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Sep 13, 2023
@MBilalShafi MBilalShafi self-assigned this Sep 13, 2023
@romgrk romgrk changed the title DataGridPro/DataGridPremium unstable_headerFilters prop incompatible with controlled filterModel, filter input field displayed incorrectly [datagrid] unstable_headerFilters not working with controlled filterModel Sep 13, 2023
@MBilalShafi MBilalShafi changed the title [datagrid] unstable_headerFilters not working with controlled filterModel [data grid] unstable_headerFilters not showing correct value with controlled filterModel Sep 13, 2023
@akullpp
Copy link

akullpp commented Sep 21, 2023

Experiencing the same issue where the experimental column header filter "eats" the input after the first debounce period. Made a GIF so you can see what I mean:

Kapture 2023-09-21 at 11 00 51

@MBilalShafi
Copy link
Member

Hi @akullpp, thank you for reporting your concern.
The issue has already been fixed and the fix should be shipped in the next library version released (possibly today or tomorrow).

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!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants