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

Strange behavior when table has no rows #495

Open
1 task done
ml1nk opened this issue Feb 20, 2025 · 2 comments
Open
1 task done

Strange behavior when table has no rows #495

ml1nk opened this issue Feb 20, 2025 · 2 comments
Labels
bug Something isn't working V2 Issue with MRT V2

Comments

@ml1nk
Copy link

ml1nk commented Feb 20, 2025

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.
@alessandrojcm
Copy link
Collaborator

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

@alessandrojcm alessandrojcm added bug Something isn't working V2 Issue with MRT V2 labels Mar 14, 2025
@ml1nk
Copy link
Author

ml1nk commented Mar 14, 2025

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
Labels
bug Something isn't working V2 Issue with MRT V2
Projects
None yet
Development

No branches or pull requests

2 participants