Skip to content

[pull] master from marmelab:master#42

Merged
pull[bot] merged 9 commits intoStars1233:masterfrom
marmelab:master
Jun 25, 2025
Merged

[pull] master from marmelab:master#42
pull[bot] merged 9 commits intoStars1233:masterfrom
marmelab:master

Conversation

@pull
Copy link
Copy Markdown

@pull pull bot commented Jun 25, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

Summary by Sourcery

Migrate all storybook examples to use the new DataTable component instead of the deprecated Datagrid, update imports and column definitions accordingly, simplify head cell rendering, and add a custom header button story for DataTable.

Enhancements:

  • Replace Datagrid usages with DataTable across story files in ra-ui-materialui and react-admin packages
  • Update imports and markup to use DataTable.Col and DataTable.NumberCol for defining columns in stories
  • Simplify DataTableHeadCell by removing the disabled TableSortLabel wrapper around non-sortable headers
  • Add a new "HeaderButton" story to showcase custom header content in DataTable

@pull pull bot added the ⤵️ pull label Jun 25, 2025
@pull pull bot merged commit cc927dd into Stars1233:master Jun 25, 2025
@gitnotebooks
Copy link
Copy Markdown

gitnotebooks bot commented Jun 25, 2025

Review these changes at https://app.gitnotebooks.com/Stars1233/react-admin/pull/42

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Jun 25, 2025

Reviewer's Guide

This PR refactors most storybook examples to adopt the new DataTable API in place of the deprecated Datagrid component (using DataTable, DataTable.Col/NumberCol, and updated imports), simplifies the DataTableHeadCell component by removing an unnecessary TableSortLabel wrapper on unsortable columns, and introduces a new HeaderButton story in DataTable.stories.tsx.

Class diagram for DataTable and Datagrid refactor

classDiagram
    class Datagrid {
        <<deprecated>>
    }
    class DataTable {
        +Col
        +NumberCol
    }
    Datagrid <|-- DataTable : replaced by
    DataTable o-- DataTable.Col
    DataTable o-- DataTable.NumberCol
Loading

Class diagram for DataTableHeadCell simplification

classDiagram
    class DataTableHeadCell {
        - label
        - source
        - resource
        + renderSortableHeader()
        + renderUnsortableHeader() // now renders FieldTitle directly
    }
    class TableSortLabel
    class FieldTitle
    DataTableHeadCell ..> TableSortLabel : uses (sortable)
    DataTableHeadCell ..> FieldTitle : uses (always)
Loading

Class diagram for new DataTable HeaderButton story

classDiagram
    class DataTable {
        +Col
    }
    class CreateButton
    class EditButton
    DataTable o-- DataTable.Col
    DataTable.Col o-- CreateButton : header (label)
    DataTable.Col o-- EditButton : cell content
Loading

File-Level Changes

Change Details Files
Replace Datagrid with DataTable and DataTable.Col/NumberCol in story files
  • Swap Datagrid imports and usage for DataTable
  • Wrap each field in DataTable.Col or DataTable.NumberCol
  • Remove TextField imports where replaced by DataTable.Col
  • Adjust bulkActionsToolbar and children placement inside DataTable.Col
packages/ra-ui-materialui/src/**/*.stories.tsx
packages/react-admin/src/Resource.stories.tsx
Simplify DataTableHeadCell unsortable header rendering
  • Remove disabled TableSortLabel wrapper
  • Render FieldTitle directly when sorting is disabled
packages/ra-ui-materialui/src/list/datatable/DataTableHeadCell.tsx
Add HeaderButton story
  • Append new export const HeaderButton example using DataTable and Create/Edit buttons
packages/ra-ui-materialui/src/list/datatable/DataTable.stories.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants