Add a new file documenting how to resolve EHSAN development environment crashes caused by stale HMR states. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 1fa9329f-0cec-4a2f-80e8-e26dbae3142e Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 05c3529b-9fb6-4549-875d-b3abd264f86f Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/4d696b13-86f2-4c9d-be0d-95b293430047/1fa9329f-0cec-4a2f-80e8-e26dbae3142e/e10exuU Replit-Helium-Checkpoint-Created: true
1.3 KiB
name, description
| name | description |
|---|---|
| EHSAN HMR context crash (false runtime error) | When the POC throws "useLanguage must be used within a LanguageProvider" but the source is correct, it's a stale HMR state — restart the workflow. |
"useLanguage must be used within a LanguageProvider" after edits
If the EHSAN POC crashes with useLanguage must be used within a LanguageProvider
(and/or Invalid hook call ... more than one copy of React, or
Cannot read properties of undefined) while App.tsx clearly wraps the tree in
LanguageProvider and the source is correct, it is almost always a corrupted
Vite Fast Refresh (HMR) state, NOT a code bug.
Root cause: src/contexts/LanguageContext.tsx exports both a component
(LanguageProvider) and a hook (useLanguage) from one file, so Vite logs
Could not Fast Refresh ("useLanguage" export is incompatible). After several hot
updates the running app ends up with a duplicate React context instance and the
hook can't find the provider.
Fix: restart the artifacts/ehsan-poc: web workflow. The built/production app
is unaffected — this is dev-only.
How to apply: before editing source to "fix" such an error, confirm the current files are actually correct (provider present, key exists); if so, just restart the workflow instead of changing code.