Skip to content

OBPIH-6846 Build checkbox logic#4999

Merged
kchelstowski merged 8 commits intodevelopfrom
OBPIH-6846
Jan 20, 2025
Merged

OBPIH-6846 Build checkbox logic#4999
kchelstowski merged 8 commits intodevelopfrom
OBPIH-6846

Conversation

@alannadolny
Copy link
Collaborator

✨ Description of Change

A concise summary of what is being changed. Please provide enough context for reviewers to be able to understand the change and why it is necessary. If the issue/ticket already provides enough information, you can put "See ticket" as the description.

Link to GitHub issue or Jira ticket:

Description: I modified the checkbox component to be able to use an indeterminate state. I also added a hook for managing checkboxes in the table.


📷 Screenshots & Recordings (optional)

If this PR contains a UI change, consider adding one or more screenshots here or link to a screen recording to help reviewers visualize the change. Otherwise, you can remove this section.
Screenshot from 2025-01-16 15-27-10

@alannadolny alannadolny self-assigned this Jan 16, 2025
@github-actions github-actions bot added domain: frontend Changes or discussions relating to the frontend UI domain: l10n Changes or discussions relating to localization & Internationalization labels Jan 16, 2025
@codecov
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 7.69%. Comparing base (e011448) to head (eb5ab59).
Report is 182 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff            @@
##             develop   #4999   +/-   ##
=========================================
  Coverage       7.69%   7.69%           
  Complexity       846     846           
=========================================
  Files            610     610           
  Lines          42586   42586           
  Branches       10344   10344           
=========================================
  Hits            3275    3275           
  Misses         38826   38826           
  Partials         485     485           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

}

.header-cell {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpicky: unnecessary indentation


// Separated from columns to reduce the amount of rerenders of
// the rest columns (on checked checkboxes change)
const checkboxesColumn = columnHelper.accessor('selected', {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you think there would be any benefit from including the useMemo here not to re-render it every single time, since a lot of compoments are built here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are benefits, because I can't use useMemo on all columns, because there are problems with refreshing the checkboxes (even with correct dependencies)

headerCheckboxProps,
} = useTableCheckboxes();

const getProductIds = () => tableData.data.map((row) => row.product.id);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this doesn't even have to be a method, but could be a const, like:

const productIds = useMemo(() => tableData.data.map(...), [<any dependency indicating the tableData changed>])

I don't know though how the re-rendering of methods is executed for such cases, whether the mapping would be proceeded in the background while re-rendering or not.

}, [checkedCheckboxes]);

useEffect(() => {
const selectedRows = checkedCheckboxes.length;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you mix two namings here - selectedRows vs checkedCheckboxes. Maybe we could align on one of them?
Moreover - for me it isn't a problem, but selectedRows sound like we store the whole rows there, not only the length, so how about adding any amountOf prefix?

@kchelstowski kchelstowski merged commit 2abdb47 into develop Jan 20, 2025
9 checks passed
@kchelstowski kchelstowski deleted the OBPIH-6846 branch January 20, 2025 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: frontend Changes or discussions relating to the frontend UI domain: l10n Changes or discussions relating to localization & Internationalization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants