Skip to content

fix: remove recharts from root dependencies to resolve duplicate React instances (Fixes #91) - #237

Merged
jobbykings merged 1 commit into
Epondia:mainfrom
NikeRegy:fix/issue-91-dedup-recharts-dependency
Jul 24, 2026
Merged

fix: remove recharts from root dependencies to resolve duplicate React instances (Fixes #91)#237
jobbykings merged 1 commit into
Epondia:mainfrom
NikeRegy:fix/issue-91-dedup-recharts-dependency

Conversation

@NikeRegy

Copy link
Copy Markdown
Contributor

Summary

Fixes #91 — Analytics page crashes with TypeError: Cannot read properties of null (reading 'useContext') from recharts' ResponsiveContainer due to duplicate React instances.

Root Cause

The pnpm workspace install creates two separate physical copies of React — one hoisted to node_modules/react/ and another inside .pnpm/react@18.3.1/node_modules/react/. The app's components resolve the former, while recharts (listed in root package.json dependencies) resolves the latter. Since React stores its hook dispatcher at the module level, useContext returns null when called from the wrong instance.

Fix

Removed recharts from root package.json dependencies. recharts is already declared in frontend/package.json, so the root dependency was unnecessary and created the duplicate React copy issue.

Changes

  • Removed recharts: ^3.7.0 from root package.json dependencies
  • Updated package-lock.json to reflect the removal

Verification

  • All recharts usage is in frontend components only (verified via code search)
  • Frontend package.json already declares recharts: ^3.8.0
  • No other workspace (backend, contracts) references recharts

…t instances

Fixes Epondia#91 - Analytics page crashes with TypeError from recharts'
ResponsiveContainer due to duplicate React copies in pnpm workspace.

recharts is already declared in frontend/package.json; having it in root
dependencies causes pnpm to create two separate React instances, breaking
hook context resolution in recharts components.

Root cause: recharts resolves React from .pnpm/react@18.3.1/node_modules/
while app components resolve from node_modules/react/, causing useContext
to return null.

Fix: Remove recharts from root package.json dependencies to ensure only
one React instance is used across the workspace.
@jobbykings
jobbykings merged commit 8e96570 into Epondia:main Jul 24, 2026
16 checks passed
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.

Fix duplicate React instances causing hook errors in recharts components (analytics page)

2 participants