Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Comments

fix: filter out contextType when copying component properties#252

Merged
Brentlok merged 1 commit intouni-stack:mainfrom
divineniiquaye:fix-05
Dec 23, 2025
Merged

fix: filter out contextType when copying component properties#252
Brentlok merged 1 commit intouni-stack:mainfrom
divineniiquaye:fix-05

Conversation

@divineniiquaye
Copy link
Contributor

This PR fixes a React runtime warning encountered during tests by excluding contextType from being copied in copyComponentProperties.

Problem

While running virtualized-list tests, React logs the following error:

Unknown: Function components do not support contextType.

The error occurs because copyComponentProperties copies contextType onto function components, which React does not support. This causes a noisy console error during rendering in tests.

Solution

  • Add contextType to the excluded properties list in copyComponentProperties
  • Ensure contextType is not applied to function components during property copying

Result

  • Eliminates the React warning during test execution
  • Keeps behavior consistent with React’s component type constraints
  • No functional changes to component behavior

Tests

  • Existing tests pass
  • No new warnings appear in virtualized-list.test.tsx

- Prevent console.error about function components not supporting contextType
- contextType is only valid for class components, not function components
- Fixes error in VirtualizedList and other wrapped components
@Brentlok Brentlok merged commit 3fc2a04 into uni-stack:main Dec 23, 2025
1 check passed
@divineniiquaye divineniiquaye deleted the fix-05 branch January 23, 2026 18:46
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