Skip to content

Fix details#201

Merged
severo merged 28 commits intomasterfrom
fix-details
Jun 4, 2025
Merged

Fix details#201
severo merged 28 commits intomasterfrom
fix-details

Conversation

@severo
Copy link
Copy Markdown
Contributor

@severo severo commented Jun 4, 2025

Clamp when loading widths from localstorage + when setting a width in the adjustment algorithm.

Also: a small refactoring to simplify the code

severo added 27 commits May 27, 2025 15:42
it fixes the types. Also: it removes the need to fix the value on the
first load (isInitialized state)
@severo severo requested a review from Copilot June 4, 2025 20:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors how column widths are clamped and adjusted by introducing a reusable clamp callback, updates the width adjustment helper to use clamp instead of a raw minWidth, and adds a test to verify loaded widths are clamped when reading from localStorage.

  • Extracted and reused a clamp function in the column states provider.
  • Updated adjustMeasuredWidths to accept a clamp callback and removed its minWidth parameter.
  • Added parameterized tests in ColumnHeader.test.tsx to ensure loaded widths respect minWidth.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/hooks/useColumnStates.tsx Introduced clamp, replaced direct minWidth logic, and updated callback dependencies
src/helpers/width.ts Changed adjustMeasuredWidths signature to use clamp and adjusted width math accordingly
src/components/ColumnHeader/ColumnHeader.test.tsx Added parameterized test cases for clamped localStorage widths
Comments suppressed due to low confidence (2)

src/hooks/useColumnStates.tsx:36

  • [nitpick] Either implement validation logic for availableWidth or remove this TODO comment to keep the codebase clean.
// ^ TODO: add a validation for availableWidth?

src/components/ColumnHeader/ColumnHeader.test.tsx:73

  • The test uses it.for, which is not a valid Jest function. Replace it with it.each (or test.each) for parameterized tests.
it.for([

Comment thread src/hooks/useColumnStates.tsx Outdated
Base automatically changed from change-algorithm-for-width to master June 4, 2025 20:44
@severo severo merged commit 93a647f into master Jun 4, 2025
10 checks passed
@severo severo deleted the fix-details branch June 4, 2025 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants