Skip to content

fix: convert icon components from class to functional to resolve defaultProps deprecation (#2912)#3325

Open
pierreeurope wants to merge 2 commits intokeplergl:masterfrom
pierreeurope:fix/base-icon-defaultprops-2912
Open

fix: convert icon components from class to functional to resolve defaultProps deprecation (#2912)#3325
pierreeurope wants to merge 2 commits intokeplergl:masterfrom
pierreeurope:fix/base-icon-defaultprops-2912

Conversation

@pierreeurope
Copy link
Copy Markdown
Contributor

Summary

Partially addresses #2912 — Eliminates React deprecation warnings for defaultProps on icon components.

Problem

React 18.3+ warns about defaultProps usage, which will be removed in a future major release. The Base icon component and all layer icon components used class components with static defaultProps, generating console warnings.

Solution

Converted all icon components from class components to functional components using JavaScript default parameters instead of static defaultProps:

  • src/layers/src/base.tsx — Core Base SVG icon component
  • src/cloud-providers/src/base.tsx — Duplicate Base component for cloud providers
  • src/cloud-providers/src/upload.tsx — Upload icon
  • src/layers/src/table.tsx — Table icon
  • All 15 layer icon components (point, arc, line, geojson, grid, hexagon, h3-hexagon, heatmap, icon, cluster, scenegraph, trip, s2, raster-tile, vector-tile, wms)

Also removed unused PropTypes imports since functional components don't use them.

Impact

  • Eliminates ~20 React deprecation warnings from the console
  • Net deletion of ~200 lines of code
  • No behavioral changes — all components render identically
  • Backward compatible — Base is still exported with the same name and props

…ultProps deprecation (keplergl#2912)

Convert Base icon component and all 17 layer/cloud-provider icon components
from class components with static defaultProps to functional components with
JavaScript default parameters. This resolves the React deprecation warning:
'Support for defaultProps will be removed from function components'.

- Replace null defaults with undefined for SVG attribute compatibility
- Remove 'size' prop from layer icons (not part of BaseProps)

Fixes keplergl#2912

Signed-off-by: pierreeurope <pierre.europe@pm.me>
@pierreeurope pierreeurope force-pushed the fix/base-icon-defaultprops-2912 branch from 4e88555 to 3adf049 Compare February 11, 2026 12:05
Signed-off-by: pierreeurope <pierre.europe@pm.me>
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.

1 participant