[data grid] Column Order State not saved on navigate away using link #12352
Labels
component: data grid
This is the name of the generic UI component, not the React module!
duplicate
This issue or pull request already exists
Steps to reproduce
Link to live example: https://mui.com/x/react-data-grid/state/#save-and-restore-the-state-from-external-storage
I've linked to the example on your site because the behavior is clearly observable there.
Steps:
related: Controlled Column Ordering
Current behavior
Column order does not persist when navigating away (using a click, as opposed to either refresh or the back button)
Expected behavior
Column order state should be maintained when user clicks away.
Context
Using the pattern demonstrated in Restore the state from Storage, I see that my column order state successfully persists when using the back button or hitting refresh on my browser, but it does not do so when navigating to another location. All other state does persist (column visibility, filters, etc.). The
beforeunload
event does occur, but what I'm seeing is that theapi.current.exportState()
object does not contain the updated column order state.Your environment
`npx @mui/envinfo`
System: OS: Windows 10 10.0.19045 Binaries: Node: 16.13.1 - C:\Program Files\nodejs\node.EXE npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD pnpm: Not Found Browsers: Chrome: 122.0.6261.71 Edge: Chromium (122.0.2365.66) npmPackages: @emotion/react: ^11.11.3 => 11.11.3 @emotion/styled: ^11.11.0 => 11.11.0 @mui/base: 5.0.0-alpha.127 @mui/core-downloads-tracker: 5.15.6 @mui/icons-material: 5.11.16 => 5.11.16 @mui/lab: 5.0.0-alpha.128 => 5.0.0-alpha.128 @mui/material: ^5.15.6 => 5.15.6 @mui/private-theming: 5.12.0 @mui/styled-engine: 5.12.0 @mui/system: 5.12.1 @mui/types: 7.2.13 @mui/utils: 5.12.0 @mui/x-data-grid: 6.19.4 @mui/x-data-grid-premium: ^6.19.4 => 6.19.4 @mui/x-data-grid-pro: 6.19.4 @mui/x-license-pro: 6.10.2 @types/react: 18.0.9 react: 17.0.1 => 17.0.1 react-dom: 17.0.1 => 17.0.1 styled-components: 5.2.3 => 5.2.3Search keywords: column state persistence restore
Order ID:
The text was updated successfully, but these errors were encountered: