Add nonce prop for MUI datagrid components#224
Open
alexdunae wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds CSP nonce support to the imodel-browser React MUI DataGrid-based table views so consumers with strict nonce-based CSP policies can avoid inline-style blocking.
Changes:
- Adds an optional
nonce?: stringprop toITwinGridMUI/IModelGridMUIand threads it through to the underlying table components. - Forwards
nonceto MUI XDataGridinITwinTableMUIandIModelTableMUI. - Adds a unit test verifying
nonceforwarding and documents usage in the module README.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/modules/imodel-browser/src/mui/containers/ITwinGrid/ITwinTableMUI.tsx | Adds nonce prop and forwards it to DataGrid. |
| packages/modules/imodel-browser/src/mui/containers/ITwinGrid/ITwinGridMUI.tsx | Adds nonce prop and passes it down to ITwinTableMUI. |
| packages/modules/imodel-browser/src/mui/containers/iModelGrid/IModelTableMUI.tsx | Adds nonce prop and forwards it to DataGrid. |
| packages/modules/imodel-browser/src/mui/containers/iModelGrid/IModelGridMUI.tsx | Adds nonce prop and passes it down to IModelTableMUI. |
| packages/modules/imodel-browser/src/mui/containers/DataGridNonce.test.tsx | Adds a test to validate nonce forwarding to the DataGrid layer. |
| packages/modules/imodel-browser/README.md | Documents how to supply a CSP nonce to the MUI grids. |
| common/changes/@itwin/imodel-browser-react/alex-datagrid-csp-nonce_2026-07-10-00-00.json | Adds a patch-level changelog entry for the new CSP nonce support. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Loading the table view of MUI components into an application with a strict CSP causes some styles to be blocked...
This PR gives consumers the ability to pass a
nonceprop: https://mui.com/x/api/data-grid/data-grid/#data-grid-prop-nonce