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

<DatagridBody> creates the <RecordContext> instead of <DatagridRow> #9808

Conversation

adguernier
Copy link
Contributor

This PR attempts to delegate the creation of a <RecordContext> to <DatagridBody> instead of <DatagridRow>

@adguernier adguernier added the WIP Work In Progress label Apr 30, 2024
@adguernier adguernier added RFR Ready For Review and removed WIP Work In Progress labels May 2, 2024
Copy link
Member

@fzaninotto fzaninotto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to remove the reconrdContextProvider from the DatagridRow

@adguernier
Copy link
Contributor Author

You also need to remove the reconrdContextProvider from the DatagridRow

Done, I pushed in a hurry

docs/Upgrade.md Outdated Show resolved Hide resolved
docs/Upgrade.md Outdated Show resolved Hide resolved
docs/Upgrade.md Outdated
Comment on lines 772 to 791
+ {data.map((record, rowIndex) => (
+ <RecordContextProvider
+ value={record}
+ key={record.id ?? `row${rowIndex}`}
+ >
+ {cloneElement(
row,
{
//...
id: record.id ?? `row${rowIndex}`,
- key: record.id ?? `row${rowIndex}`,
onToggleItem,
- record,
resource,
//...
},
children
- )
)}
+ </RecordContextProvider>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong diff: you should show how a custom DatagridRow no longer reads the record from its props, but from the Recordcontext.

docs/Upgrade.md Outdated Show resolved Hide resolved
docs/Upgrade.md Outdated Show resolved Hide resolved
@djhi djhi added this to the 5.0.0 milestone May 13, 2024
@djhi djhi merged commit ef8e610 into next May 13, 2024
13 checks passed
@djhi djhi deleted the datagrid-body-oss-should-create-a-record-context-instead-of-datagrid-row branch May 13, 2024 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants