Skip to content

Feature-7111-Unify column width definitions across spreadsheet components#8730

Open
Seth-Wadsworth wants to merge 2 commits intomakeplane:previewfrom
WSU-CptS-481-Spring-2026:SW-Feature-7111
Open

Feature-7111-Unify column width definitions across spreadsheet components#8730
Seth-Wadsworth wants to merge 2 commits intomakeplane:previewfrom
WSU-CptS-481-Spring-2026:SW-Feature-7111

Conversation

@Seth-Wadsworth
Copy link

@Seth-Wadsworth Seth-Wadsworth commented Mar 8, 2026

Description

This PR refactors the spreadsheet layout to make column sizing more consistent and predictable across the issue list. The previous implementation contained duplicated width logic across header and row components, which led to inconsistent behavior and made future changes difficult to maintain. This update introduces a centralized getColumnWidth utility that determines column widths based on content characteristics, allowing flexible columns such as Title and Description to expand while keeping short, fixed‑width fields like ID, State, and Estimate static. The refactor removes inline width definitions, unifies sizing logic across components, and improves layout stability without introducing resizable columns, which were evaluated but determined to be incompatible with Plane’s dynamic rendering and MobX‑driven architecture.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Test Scenarios

Testing included both unit tests and manual regression testing:
Unit tests were added for getColumnWidth to verify that static and flexible columns return the correct width values under different conditions.
Manual testing confirmed that header and row cells remain aligned across all column configurations.
Verified that flexible columns expand appropriately when additional content or new columns are introduced.
Ensured that no regressions occurred in virtualization behavior, horizontal scrolling, or responsive layout handling.
Confirmed that both header and row components now consume width values from the same centralized source.

References

#7111

Summary by CodeRabbit

  • Refactor

    • Reorganized spreadsheet column width management with standardized utilities, ensuring consistent and predictable layout dimensions across all property types in the spreadsheet view.
    • Centralized issue update handling logic in spreadsheet views for more reliable and consistent update operations.
  • Tests

    • Added comprehensive test coverage for spreadsheet width calculations and issue update mechanisms across various property types.

@CLAassistant
Copy link

CLAassistant commented Mar 8, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 8, 2026

📝 Walkthrough

Walkthrough

This PR extracts column width definitions and issue update logic into dedicated TypeScript modules for the spreadsheet layout. It centralizes width mappings for issue columns and header columns, along with a utility function for handling issue updates safely.

Changes

Cohort / File(s) Summary
Issue Column Logic
apps/web/core/components/issues/issue-layouts/spreadsheet/issue-column.logic.ts, apps/web/core/components/issues/issue-layouts/spreadsheet/issue-column.tsx
Extracted column width mappings and issue update logic into a new logic module. Introduces COLUMN_WIDTHS constant, getColumnWidth helper, and handleUpdateIssueLogic utility. Component now uses dynamic inline styles for width and delegates updates through the centralized logic function.
Spreadsheet Header Column Logic
apps/web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-header-column.logic.ts, apps/web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-header-column.tsx
Created new logic module with HEADER_COLUMN_WIDTHS mapping and getHeaderColumnWidth helper function. Header component now applies dynamic width styling using the extracted width getter.
Test Coverage
packages/codemods/tests/issue-column.logic.test.ts, packages/codemods/tests/spreadsheet-header-column.logic.test.ts
Added comprehensive test suites validating getColumnWidth/getHeaderColumnWidth behavior with known property widths and "auto" fallback for unknown keys. Included tests for handleUpdateIssueLogic to verify safe callback invocation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Widths are organized, logic extracted clean,
Column measurements in constants serene,
Updates delegated through helpers so neat,
Spreadsheet refactoring, the cleanup complete! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description is comprehensive and well-structured, covering the rationale for the refactor, implementation details, testing approach, and references to the related issue.
Title check ✅ Passed The title accurately describes the main change: unifying column width definitions across spreadsheet components by introducing centralized logic utilities.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/web/core/components/issues/issue-layouts/spreadsheet/issue-column.tsx`:
- Around line 54-56: The onChange callback is currently fire-and-forgeting the
promise from handleUpdateIssueLogic(updateIssue, issue, data) which can drop
rejections; change this to either make the callback async and await the call
inside a try-catch or explicitly attach .catch() to the returned promise, and in
the catch log the error (using the same logging mechanism as the component) and
surface a user-friendly failure path; update references are
handleUpdateIssueLogic and updateIssue so wrap that invocation in try { await
handleUpdateIssueLogic(updateIssue, issue, data); } catch (err) { /* log/handle
err */ } or at minimum handleUpdateIssueLogic(...).catch(err => { /* log/handle
err */ }).

In
`@apps/web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-header-column.logic.ts`:
- Around line 3-22: HEADER_COLUMN_WIDTHS duplicates COLUMN_WIDTHS causing drift;
remove the duplicate map and have getHeaderColumnWidth read from the single
source COLUMN_WIDTHS (e.g., replace HEADER_COLUMN_WIDTHS[property] with
COLUMN_WIDTHS[property] ?? "auto"), ensure COLUMN_WIDTHS is imported/available
in this module and typed compatibly with Partial<Record<keyof
IIssueDisplayProperties, string>>, and if HEADER_COLUMN_WIDTHS is exported
elsewhere update those consumers to use COLUMN_WIDTHS so there's only one
canonical widths map.

In
`@apps/web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-header-column.tsx`:
- Around line 39-42: The th element's className contains the Tailwind utility
"min-w-36" which forces a 9rem minimum and overrides the fixed widths from
getHeaderColumnWidth(property); remove "min-w-36" from the className and instead
drive minWidth from the same helper by adding a minWidth style (e.g., set style
to include width: getHeaderColumnWidth(property) and minWidth:
getHeaderColumnWidth(property)) so columns like state/priority/estimate can
actually render at the computed 80px width; update the th that uses
tableHeaderCellRef and getHeaderColumnWidth accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5f478554-a1c1-4fe8-a32d-c257b8e8d008

📥 Commits

Reviewing files that changed from the base of the PR and between 6627282 and 992c063.

📒 Files selected for processing (6)
  • apps/web/core/components/issues/issue-layouts/spreadsheet/issue-column.logic.ts
  • apps/web/core/components/issues/issue-layouts/spreadsheet/issue-column.tsx
  • apps/web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-header-column.logic.ts
  • apps/web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-header-column.tsx
  • packages/codemods/tests/issue-column.logic.test.ts
  • packages/codemods/tests/spreadsheet-header-column.logic.test.ts

Comment on lines +54 to +56
onChange={(issue, data) => {
void handleUpdateIssueLogic(updateIssue, issue, data);
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Don’t fire-and-forget the issue update promise.

Line 55 drops rejections from the async update path, so a failed write can turn into an unhandled promise rejection with no user-visible recovery. Please catch/log the error here, or make the callback async and handle failures explicitly. As per coding guidelines, "Use try-catch with proper error types and log errors appropriately for error handling".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/core/components/issues/issue-layouts/spreadsheet/issue-column.tsx`
around lines 54 - 56, The onChange callback is currently fire-and-forgeting the
promise from handleUpdateIssueLogic(updateIssue, issue, data) which can drop
rejections; change this to either make the callback async and await the call
inside a try-catch or explicitly attach .catch() to the returned promise, and in
the catch log the error (using the same logging mechanism as the component) and
surface a user-friendly failure path; update references are
handleUpdateIssueLogic and updateIssue so wrap that invocation in try { await
handleUpdateIssueLogic(updateIssue, issue, data); } catch (err) { /* log/handle
err */ } or at minimum handleUpdateIssueLogic(...).catch(err => { /* log/handle
err */ }).

Comment on lines +3 to +22
export const HEADER_COLUMN_WIDTHS: Partial<Record<keyof IIssueDisplayProperties, string>> = {
state: "80px",
priority: "80px",
assignee: "120px",
estimate: "80px",
labels: "80px",
start_date: "120px",
due_date: "120px",
created_on: "120px",
updated_on: "120px",
link: "80px",
attachment_count: "80px",
sub_issue_count: "80px",
cycle: "120px",
modules: "120px",
};

export function getHeaderColumnWidth(property: keyof IIssueDisplayProperties): string {
return HEADER_COLUMN_WIDTHS[property] ?? "auto";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Keep a single source of truth for column widths.

HEADER_COLUMN_WIDTHS duplicates COLUMN_WIDTHS entry-for-entry, so the next width change can desync header and body cells again. This refactor is supposed to centralize sizing; please reuse one shared map/helper here instead of maintaining a second copy.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-header-column.logic.ts`
around lines 3 - 22, HEADER_COLUMN_WIDTHS duplicates COLUMN_WIDTHS causing
drift; remove the duplicate map and have getHeaderColumnWidth read from the
single source COLUMN_WIDTHS (e.g., replace HEADER_COLUMN_WIDTHS[property] with
COLUMN_WIDTHS[property] ?? "auto"), ensure COLUMN_WIDTHS is imported/available
in this module and typed compatibly with Partial<Record<keyof
IIssueDisplayProperties, string>>, and if HEADER_COLUMN_WIDTHS is exported
elsewhere update those consumers to use COLUMN_WIDTHS so there's only one
canonical widths map.

Comment on lines 39 to 42
<th
className="h-11 min-w-36 items-center bg-layer-1 text-13 font-medium py-1 border border-b-0 border-t-0 border-subtle"
style={{ width: getHeaderColumnWidth(property) }}
ref={tableHeaderCellRef}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

min-w-36 is overriding the new fixed widths.

Line 40 still forces every header cell to at least 9rem, so columns like state, priority, and estimate will never render at the 80px width returned on Line 41. In a table layout that widens the whole column, not just the header. Remove that utility or drive minWidth from the same helper.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-header-column.tsx`
around lines 39 - 42, The th element's className contains the Tailwind utility
"min-w-36" which forces a 9rem minimum and overrides the fixed widths from
getHeaderColumnWidth(property); remove "min-w-36" from the className and instead
drive minWidth from the same helper by adding a minWidth style (e.g., set style
to include width: getHeaderColumnWidth(property) and minWidth:
getHeaderColumnWidth(property)) so columns like state/priority/estimate can
actually render at the computed 80px width; update the th that uses
tableHeaderCellRef and getHeaderColumnWidth accordingly.

@Seth-Wadsworth Seth-Wadsworth changed the title Sw feature 7111 Feature-7111-Unify column width definitions across spreadsheet components Mar 8, 2026
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