fix: remove recharts from root dependencies to resolve duplicate React instances (Fixes #91) - #237
Merged
jobbykings merged 1 commit intoJul 24, 2026
Conversation
…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.
Closed
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #91 — Analytics page crashes with
TypeError: Cannot read properties of null (reading 'useContext')from recharts'ResponsiveContainerdue 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 rootpackage.jsondependencies) resolves the latter. Since React stores its hook dispatcher at the module level,useContextreturnsnullwhen called from the wrong instance.Fix
Removed
rechartsfrom rootpackage.jsondependencies.rechartsis already declared infrontend/package.json, so the root dependency was unnecessary and created the duplicate React copy issue.Changes
recharts: ^3.7.0from rootpackage.jsondependenciespackage-lock.jsonto reflect the removalVerification
rechartsusage is in frontend components only (verified via code search)package.jsonalready declaresrecharts: ^3.8.0