Skip to content

Invalid Typescript of "getRowId" props when "isLoading" is true and "data" is empty #1494

Open

Description

@peanudge

material-react-table version

v3.2.1

react & react-dom versions

v19.2.0

Describe the bug and the steps to reproduce it

This issue is just typescript bug, but i hope MRT has better typescript for safety type.

When insert data: [] and state: { isLoading: true } and getRowId: (data) => data.id.toString() as useMeterialReactTable props, getRowId function raise exception (Cannot read properties of null (reading 'toString')).

=> i believe natuaral situation with empty data and loading.

useMaterialReactTable's getRowId function prop requires always TData extends MRT_RowData.

On runtime with above conditions, row data can be null-optional object by this logic for loading skeleton UI.

Minimal, Reproducible Example - (Optional, but Recommended)

https://stackblitz.com/edit/github-fofcgbmf?file=src%2FTS.tsx

Screenshots or Videos (Optional)

  • getRowId argument type allows to use TData type itself

Image

Do you intend to try to help solve this bug with your own PR?

Yes, I think I know how to fix it and will discuss it in the comments of this issue

Terms

  • I understand that if my bug cannot be reliably reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Activity

  1. stanislawski64 commented on Jan 19, 2026

    @stanislawski64

    I can confirm this issue - I'm also running into it in my project.

    Having async data fetching (data initially []) with isLoading set to true, and conforming to typescript in getRowId, causes the app to crash at runtime.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions