Skip to content

Strange behavior when table has no rows #495

Open

Description

@ml1nk

mantine-react-table version

v2.0.0-beta.9

react & react-dom versions

v19

Describe the bug and the steps to reproduce it

I think because of #445 the behavior of empty rows changed and lead to issues with renderDetailPanel and mantineTableBodyCellProps/onClick. Both now trigger if there are no rows, but naturally row.original is an empty object. This doesn't match the typing, because original is T from MRT_Row. It can be catched by the id field which is always "mrt-row-empty".

Additionally it shows a disabled Details button if you return undefined in renderDetailPanel on an empty row.
Image

From the original PR all these changes seem somewhat intended, but at least the typing is now incorrect and it would be nice to have a flag to get the old behavior back. What do you think?

Minimal, Reproducible Example - (Optional, but Recommended)

https://v2.mantine-react-table.com/docs/guides/detail-panel#enable-detail-panel-demo

Image

Screenshots or Videos (Optional)

No response

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

None

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. alessandrojcm commented on Mar 14, 2025

    @alessandrojcm
    Collaborator

    If I understood correctly, the problem is about a typing mismatch and the expansion arrow showing up, rather than a bug per se?

  2. added
    bug
    V2
    on Mar 14, 2025
  3. ml1nk commented on Mar 14, 2025

    @ml1nk
    Author

    Yeah, essentially these two are the bugs I tried to explain. Additionally I would argue that it would be better to at least have a flag to disable the calls to renderDetailPanel and mantineTableBodyCellProps/onClick with the default empty row item, because otherwise it would need to be filtered every time if unwanted.

    Currently it just breaks our current code without any warning because of the unchanged typing, which lead me to investigate it.

    Just to make sure, I'm very happy with this project and if you think that no additional flag is need I will just do the filtering and try to updating again :)

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

    V2bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions