Skip to content

feat: can use a wrapper on panel when using items props of collapse - #335

Open
Asanio06 wants to merge 1 commit into
react-component:masterfrom
Asanio06:master
Open

feat: can use a wrapper on panel when using items props of collapse#335
Asanio06 wants to merge 1 commit into
react-component:masterfrom
Asanio06:master

Conversation

@Asanio06

Copy link
Copy Markdown

Today its not possible to add some wrapper like Context when using items props with Collapse

@vercel

vercelBot commented Jan 8, 2024

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

NameStatusPreviewCommentsUpdated (UTC)
collapse❌ Failed (Inspect)Jan 8, 2024 9:31am

@codecov

codecovBot commented Jan 8, 2024

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 98.29%. Comparing base (1def17f) to head (cb9d480).
⚠️ Report is 45 commits behind head on master.

Files with missing linesPatch %Lines
src/hooks/useItems.tsx66.66%1 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## master #335 +/- ##
==========================================
- Coverage 99.12% 98.29% -0.84% 
==========================================
Files 5 5 Lines 114 117 +3 Branches 40 41 +1 ==========================================
+ Hits 113 115 +2 - Misses 1 2 +1 

☔ View full report in Codecov by Harness.
📢 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.

@nrps9909nrps9909 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.

I checked exact head cb9d48073b0b0ea94ebd022c824c7c7be8347e32. The new public API is not type-correct as written: ItemType.wrapper is declared as ReactNode, but convertItemsToNodes calls it as wrapper(collapsePanel).

Running npx tsc --noEmit --ignoreDeprecations 6.0 reports the issue directly at src/hooks/useItems.tsx:74:

TS2349: This expression is not callable.
No constituent of type 'string | number | bigint | true | ReactElement<...> | Iterable<ReactNode> | ReactPortal | Promise<...>' is callable.

This also means the intended consumer form, such as wrapper: panel => <Context.Provider value={...}>{panel}</Context.Provider>, cannot satisfy the exported ItemType contract. Please type the render callback explicitly (for example, (panel: React.ReactElement) => React.ReactNode, with the exact element type narrowed as appropriate) and add both a type/API regression and a runtime test for the wrapper path. The runtime regression should also rerender/reorder multiple keyed items so the wrapper does not accidentally discard top-level key identity.

For context, the existing runtime suite passes (1 suite, 92 tests, 1 snapshot), but it does not exercise wrapper; both Codecov project and patch checks are currently failing. This needs the public type and coverage fixed before merge.

AI assistance disclosure: Codex was used to inspect the exact diff, run the repository test/type checks, and draft this review. I verified the reported compiler output against the PR head above.

Sign up for freeto 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

@Asanio06@nrps9909