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

Row action buttons in Advanced example do not work correctly when all rows are selected #361

Open
1 task done
sijonelis opened this issue Jun 15, 2024 · 1 comment
Open
1 task done
Labels
V2 Issue with MRT V2 wontfix This will not be worked on

Comments

@sijonelis
Copy link
Contributor

sijonelis commented Jun 15, 2024

mantine-react-table version

2.0.0-beta.4

react & react-dom versions

18.2.0

Describe the bug and the steps to reproduce it

Go to the advanced example page: https://v2.mantine-react-table.com/docs/examples/advanced#advanced-example and

  1. No rows selected: action buttons are inactive
  2. Select one row. The action buttons become active
  3. Filter out a single row by the exact filter match (see screenshot 1): buttons become inactive (they shouldn't!)
  4. Make the filter more ambiguous to contain >1 row: buttons become active (see screenshot 2)
  5. Click "select all": action buttons become inactive again (see screenshot 3). (they shouldn't!)

image
image
image

Minimal, Reproducible Example - (Optional, but Recommended)

Provided in repro: https://v2.mantine-react-table.com/docs/examples/advanced#advanced-example

Screenshots or Videos (Optional)

No response

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

Maybe, I'll investigate and start debugging

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.
@sijonelis sijonelis changed the title table.getIsSomeRowsSelected() incorrectly reports false when filter returns exactly one row table.getIsSomeRowsSelected() incorrectly reports false when all available rows are selected Jun 15, 2024
@sijonelis
Copy link
Contributor Author

sijonelis commented Jun 15, 2024

Upon digging deeper into Tanstack docs, it is an issue within their API.

While their documentation states that

getIsSomeRowsSelected: () => boolean
Returns whether or not any rows in the table are selected.

It is mutually exclusive with getIsAllRowsSelected

Thus currently the "correct "way to render the advanced example should be:

... same for other buttons 
<Button
              color="blue"
              disabled={!table.getIsSomeRowsSelected()  && !table.getIsAllRowsSelected()}
              onClick={handleContact}
              variant="filled"
            >
              Contact
</Button>

Tanstack tables repo already has an issue to track this, so hopefully this will be fixed in the future release.
Keeping that in mind I think it is not worth it to do any changes on this project's examples, just have to keep this in mind until the issue is fixed on the Tanstack side.

I'll leave it up to the team whether to keep this issue open or close it~

@sijonelis sijonelis changed the title table.getIsSomeRowsSelected() incorrectly reports false when all available rows are selected Row action buttons in Advanced example do not work correctly when all rows are selected Jun 15, 2024
@alessandrojcm alessandrojcm added wontfix This will not be worked on V2 Issue with MRT V2 labels Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V2 Issue with MRT V2 wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants