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

deprecated @material-ui/core prop-type updates #2937

Closed
wants to merge 2 commits into from

Conversation

matthoffner
Copy link

@matthoffner matthoffner commented Jul 7, 2021

Related Issue

#2935

Description

Prop type updates from @material-ui/core deprecated prop types:

  • Updates onChangePage to onPageChange
  • Updates onChangeRowsPerPage to onRowsPerPageChange

@matthoffner matthoffner requested a review from mbrn as a code owner July 7, 2021 23:24
@matthoffner matthoffner changed the title rename onChangePage to onPageChange per material-ui updates deprecated @material-ui/core prop-type updates Jul 7, 2021
@matthoffner
Copy link
Author

Hi @mbrn this is a PR to fix #2935 with the latest @material-ui/core updates in 4.12.0 causing prop type errors. It would be great if we can get a release out soon with this, thanks!

@IniterWorker
Copy link
Contributor

Hi,

I agree with @matthoffner this merge request needs to be released as soon as possible.

Good work,

@Beta-7 Beta-7 mentioned this pull request Jul 10, 2021
@ssp5zone
Copy link

That's weird. mat-ui removed a deprecation in a minor release! That could (and will) break stuff for people if mat-ui dependency is not patch limited.

Anyways, thanks @matthoffner; was going to make this change until I saw your PR.

@srikanthj09
Copy link

Hi,

can we get this fix release asap,

@chelproc
Copy link
Contributor

For those who can't wait for this PR to be released, I wrote a small TablePagination patch.

import MaterialTable, { MaterialTableProps } from 'material-table';
import { TablePagination, TablePaginationProps } from '@material-ui/core';

function PatchedPagination(props: TablePaginationProps) {
  const {
    ActionsComponent,
    onChangePage,
    onChangeRowsPerPage,
    ...tablePaginationProps
  } = props;

  return (
    <TablePagination
      {...tablePaginationProps}
      // @ts-expect-error onChangePage was renamed to onPageChange
      onPageChange={onChangePage}
      onRowsPerPageChange={onChangeRowsPerPage}
      ActionsComponent={(subprops) => {
        const { onPageChange, ...actionsComponentProps } = subprops;
        return (
          // @ts-expect-error ActionsComponent is provided by material-table
          <ActionsComponent
            {...actionsComponentProps}
            onChangePage={onPageChange}
          />
        );
      }}
    />
  );
}

Then you can use this like:

<MaterialTable
  components={{
    Pagination: PatchedPagination,
  }}
/>

@ap705
Copy link

ap705 commented Jul 15, 2021

Hey, I'm also waiting for this fix to be merged! Could somebody approve it by any chance? Thanks !

Thanks @chelproc for the temporary fix!

@Beta-7
Copy link

Beta-7 commented Jul 15, 2021

From what i gathered from the gitter chat the project has been abandoned and replaced by https://github.com/material-table-core/core. Someone feel free to correct me and i will remove the comment.

@manjuprem12
Copy link

This is blocking us from releasing the latest version of our product. would appreciate this merge the earliest.

@matthoffner
Copy link
Author

Hello @mbrn could you prioritize reviewing and releasing this to keep this project working with latest material ui changes.

This PR is scoped to fixing a small bug change only, as specifically stated in the README. Thanks.

@arshkkk
Copy link

arshkkk commented Aug 28, 2021

For those who can't wait for this PR to be released, I wrote a small TablePagination patch.

import MaterialTable, { MaterialTableProps } from 'material-table';
import { TablePagination, TablePaginationProps } from '@material-ui/core';

function PatchedPagination(props: TablePaginationProps) {
  const {
    ActionsComponent,
    onChangePage,
    onChangeRowsPerPage,
    ...tablePaginationProps
  } = props;

  return (
    <TablePagination
      {...tablePaginationProps}
      // @ts-expect-error onChangePage was renamed to onPageChange
      onPageChange={onChangePage}
      onRowsPerPageChange={onChangeRowsPerPage}
      ActionsComponent={(subprops) => {
        const { onPageChange, ...actionsComponentProps } = subprops;
        return (
          // @ts-expect-error ActionsComponent is provided by material-table
          <ActionsComponent
            {...actionsComponentProps}
            onChangePage={onPageChange}
          />
        );
      }}
    />
  );
}

Then you can use this like:

<MaterialTable
  components={{
    Pagination: PatchedPagination,
  }}
/>

This quick fix is increasing bundle size from 128kb to 400kb

@orinoco
Copy link

orinoco commented Oct 13, 2021

If you end up here like I did, check out https://github.com/material-table-core/website/blob/master/docs/getting-started/material-ui-v5.mdx

romantech added a commit to romantech/beer-table that referenced this pull request Nov 7, 2021
- new file: src/Components/PatchedPagination.js
- 참고 링크 : mbrn/material-table#2937 (comment)
@stale
Copy link

stale bot commented Jan 12, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

@stale stale bot added the wontfix This will not be worked on label Jan 12, 2022
@stale stale bot closed this Jan 19, 2022
@thisisglee
Copy link

For those who need @chelproc Javascript not type script version

`import MaterialTable from 'material-table';
import { TablePagination } from '@material-ui/core';

//javascript version
function PatchedPagination(props) {
const { ActionsComponent, onChangePage, onChangeRowsPerPage, ...tablePaginationProps } = props;

return (
<TablePagination
{...tablePaginationProps}
// @ts-expect-error onChangePage was renamed to onPageChange
onPageChange={onChangePage}
onRowsPerPageChange={onChangeRowsPerPage}
ActionsComponent={(subprops) => {
const { onPageChange, ...actionsComponentProps } = subprops;
return (
// @ts-expect-error ActionsComponent is provided by material-table
<ActionsComponent {...actionsComponentProps} onChangePage={onPageChange} />
);
}}
/>
);
}`

@Alayanos
Copy link

_this.props.data is not a function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.