-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create Table and Select All Checkbox #38
Create Table and Select All Checkbox #38
Conversation
} else { | ||
selectedDocumentIds.delete(selectedId); | ||
} | ||
setSelectedDocumentIds((prev) => new Set(prev)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing Set.add
and Set.delete
won't trigger a React state update because the object itself has not changed (even though its contents did).
To force a state update, I'm creating a new Set copied off the mutated previous Set.
<Tr> | ||
<Th> | ||
<Checkbox | ||
isChecked={selectedDocumentIds.size === documents.length} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This covers the case where someone selects all checkboxes, and then deselects one of them - we want the select all checkbox to be deselected in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!! 🔥🔥
Notion Ticket Link
Create Table and Select All Checkbox
Implementation Description
Steps to Test
Check that the ids logged in the console correspond to the ids you are selecting!
Screenshots (optional)
Checklist
Linting & Formatting
Mac
Windows