Skip to content

datagrid-contructor-api-mismatch#1755

Open
prasannaPratapSingh wants to merge 1 commit into
Karanjot786:mainfrom
prasannaPratapSingh:fix/datagrid-constructor-mismatch
Open

datagrid-contructor-api-mismatch#1755
prasannaPratapSingh wants to merge 1 commit into
Karanjot786:mainfrom
prasannaPratapSingh:fix/datagrid-constructor-mismatch

Conversation

@prasannaPratapSingh

@prasannaPratapSingh prasannaPratapSingh commented Jun 22, 2026

Copy link
Copy Markdown

Description

Fixes a runtime crash in the data-grid example caused by passing a single object { columns, rows } to DataGrid
instead of positional arguments. Changed to new DataGrid(columns, rows) to match the actual constructor signature.

Related Issue

Closes #1754

Which package(s)?

examples/data-grid

Type of Change

  • 🐛 Bug fix (type:bug)
  • ✨ Feature (type:feature)
  • 📝 Docs (type:docs)
  • 🧪 Tests (type:testing)
  • ♻️ Refactor (type:refactor)
  • 🎨 Design / UX (type:design)
  • ♿ Accessibility (type:accessibility)
  • ⚡ Performance (type:performance)
  • 🔧 DevOps / CI (type:devops)
  • 🔒 Security (type:security)

Checklist

  • ⭐ You starred the repo. The needs-star check blocks your merge otherwise.
  • Tests pass locally: bun vitest run
  • Build passes: bun run build
  • Typecheck passes: bun run typecheck
  • You read CONTRIBUTING.md.
  • Your PR title follows type: short description.
  • Widget state mutators call markDirty() (if your change affects rendering).
  • No new any types without an inline comment explaining why.
  • No unrelated refactors bundled into this PR.

GSSoC 2026 Participation

  • You are a GSSoC 2026 contributor.
  • Your GSSoC profile: https://gssoc.girlscript.org/profile/____

Screenshots / Recordings (UI changes)

N/A — no UI change, this is a one-line constructor call fix.

Notes for the Reviewer

The DataGrid constructor takes positional args (columns, rows, style?, options?). The example was passing { columns, rows } as a single object which caused TypeError: columns.map is not a function at runtime. One-line fix
in examples/data-grid/src/index.tsx.

Summary by CodeRabbit

  • Documentation
    • Updated DataGrid example code to reflect current initialization patterns.

@github-actions github-actions Bot added the area:examples Example apps. label Jun 22, 2026
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2fbdcf55-4dac-4e51-a2eb-3887072738d6

📥 Commits

Reviewing files that changed from the base of the PR and between 35c2213 and 7df56ad.

📒 Files selected for processing (1)
  • examples/data-grid/src/index.tsx

📝 Walkthrough

Walkthrough

The DataGrid constructor call in examples/data-grid/src/index.tsx is corrected from passing a single { columns, rows } object to passing columns and rows as two separate positional arguments, matching the actual constructor signature.

Changes

Fix DataGrid Constructor Invocation

Layer / File(s) Summary
DataGrid constructor argument fix
examples/data-grid/src/index.tsx
Changes new DataGrid({ columns, rows }) to new DataGrid(columns, rows), aligning the call with the DataGrid(columns, rows, style?, options?) positional signature.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐇 A grid was crashing, columns gone astray,
Wrapped in an object, lost in dismay.
One little comma set the two free,
columns, rows — positional, as they should be!
The bunny hops on, the grid's here to stay. 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title 'datagrid-contructor-api-mismatch' describes the core issue (constructor API mismatch) but does not follow the required 'type: short description' format specified in the template. Update the title to follow the required format: 'fix: correct DataGrid constructor call in data-grid example' to match the repository's title convention.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The PR description comprehensively covers all required sections including description, related issue, package(s), type of change, and checklist completion.
Linked Issues check ✅ Passed The PR successfully addresses the objective from issue #1754 by fixing the DataGrid constructor call from an object argument to positional arguments (columns, rows).
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the runtime error in the data-grid example; no unrelated refactors or out-of-scope modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎉 Thanks for your first PR to TermUI, @prasannaPratapSingh.

Before your PR merges:

  1. Star the repo. Required. The star-check job blocks your merge otherwise.
  2. ✅ All checks green: build, test, typecheck.
  3. 🏷 PR title follows type: short description. Example: fix: handle empty list.
  4. 🔗 Link your closing issue in the description.

GSSoC 2026 points come from labels after merge:

  • gssoc:approved. +50 base points.
  • level:beginner / intermediate / advanced / critical. +20 / +35 / +55 / +80.
  • quality:clean / exceptional. x 1.2 / x 1.5.
  • type:*. Stackable bonus.

Your reviewer responds within 48 hours. Ping @Karanjot786 on Discord for urgent help.

🚀 Welcome to the cohort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:examples Example apps.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Title: bug(examples): data-grid example crashes due to wrong DataGrid constructor call

1 participant