Comments (9)
The issue you are seeing is caused by defining the styled versions of the components within the body of your App component. As a rule, you should never define components inside of another component.
const Component1 = () => {
// ❌ new component is created on every rerender
const Component2 = () => <div>Component 2</div>;
return <Component2 />
}
// ✅ the component is defined once
const Component2 = () => <div>Component 2</div>;
const Component1 = () => {
return <Component2 />
}
See the updated example where I have moved the StyledDataGrid
outside of the App
component: https://codesandbox.io/p/sandbox/13636-re-rendering-resetting-filter-on-state-change-jp7gxs?file=%2Fsrc%2FApp.js%3A136%2C34
from mui-x.
To help us diagnose the issue efficiently, could you provide a stripped-down reproduction test case using the latest version? A live example would be fantastic! ✨
For your convenience, our documentation offers templates and guides on creating targeted examples: Support - Bug reproduction
Just a friendly reminder: clean, functional code with minimal dependencies is most helpful. Complex code can make it tougher to pinpoint the exact issue. Sometimes, simply going through the process of creating a minimal reproduction can even clarify the problem itself!
Thanks for your understanding! 🙇🏼
from mui-x.
I tried to reproduce this issue on code sandbox please check here. issue
It is due to the StyledDataGrid. If you use DataGrid instead of StyledDataGrid it will work.
from mui-x.
I was also facing the same problem when I updated to version 7. I use server-side pagination, and when a page is changed I update the data based on that page change. the onPaginationModelChange
callback is triggered again with the initial page.
But I found that I wasn't memoizing the rowCount when new data was loaded as recommended by MUI at: https://mui.com/x/react-data-grid/pagination/#server-side-pagination, I changed it accordingly and everything has started working so far.
@rahulchougule I am not able to access your sandbox at the link you provided: https://codesandbox.io/s/sharp-alex-vn2srr
from mui-x.
@segullshairbutt you can try now
from mui-x.
@segullshairbutt you can try now
from mui-x.
@segullshairbutt you can try now
There is a typo in this link, it should be https://codesandbox.io/p/sandbox/sharp-alex-vn2srr
I have updated the issue description with a link to this.
from mui-x.
@KenanYusuf Got your point. Thank you for your updates.
from mui-x.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
@rahulchougule: 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.
from mui-x.
Related Issues (20)
- [docs] Recommended Pickers styling approach shown on all styling approaches HOT 3
- [pickers] MUI DateRangePicker property "name" doesnt render HOT 3
- [charts][RFC] Replace `DefaultXxxx` by the usage of hooks
- [charts] Remove deprecated props
- [data grid] Cell stealing focus from modal and onClicks for buttons rendered inside cells fire when the user hits the enter key HOT 1
- Create PDF component HOT 7
- [data grid] is there anyway to avoid copy paste functionality from one column to another? HOT 3
- [tree view][TreeItem] Add support for `href` attribute HOT 5
- [data grid] Check the grouped child rows on select of the grouped row HOT 3
- [data grid] Resizing columns gets misaligned HOT 1
- [charts] Get access to the data outside of the SVG
- [charts] Document the usage of foreingObject
- [fields][DateField] on Android: using DateField on firefox doesn't work HOT 1
- [data grid] Impact of not renewing license for small changes and bug fixes HOT 3
- [data grid] `GridToolbarExport` does not consider `color` and `size` props anymore HOT 4
- [data grid] print layout of Export > Print is broken HOT 2
- [data grid] CSV export adds malformed/buggy characters HOT 2
- [TreeView] Expose the item slots at the tree view level
- [data grid] Is Clipboard cut available? HOT 1
- [data grid] Save / Restore state with dynamic columns HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mui-x.